comphead commented on code in PR #2614:
URL: https://github.com/apache/datafusion-comet/pull/2614#discussion_r2449266503


##########
fuzz-testing/src/main/scala/org/apache/comet/fuzz/Meta.scala:
##########
@@ -35,100 +61,261 @@ object Meta {
     (DataTypes.createDecimalType(10, 2), 0.2),
     (DataTypes.DateType, 0.2),
     (DataTypes.TimestampType, 0.2),
-    // TimestampNTZType only in Spark 3.4+
-    // (DataTypes.TimestampNTZType, 0.2),
+    (DataTypes.TimestampNTZType, 0.2),
     (DataTypes.StringType, 0.2),
     (DataTypes.BinaryType, 0.1))
 
-  val stringScalarFunc: Seq[Function] = Seq(
-    Function("substring", 3),
-    Function("coalesce", 1),
-    Function("starts_with", 2),
-    Function("ends_with", 2),
-    Function("contains", 2),
-    Function("ascii", 1),
-    Function("bit_length", 1),
-    Function("octet_length", 1),
-    Function("upper", 1),
-    Function("lower", 1),
-    Function("chr", 1),
-    Function("init_cap", 1),
-    Function("trim", 1),
-    Function("ltrim", 1),
-    Function("rtrim", 1),
-    Function("string_space", 1),
-    Function("rpad", 2),
-    Function("rpad", 3), // rpad can have 2 or 3 arguments
-    Function("hex", 1),
-    Function("unhex", 1),
-    Function("xxhash64", 1),
-    Function("sha1", 1),
-    // Function("sha2", 1), -- needs a second argument for number of bits
-    Function("substring", 3),
-    Function("btrim", 1),
-    Function("concat_ws", 2),
-    Function("repeat", 2),
-    Function("length", 1),
-    Function("reverse", 1),
-    Function("instr", 2),
-    Function("replace", 2),
-    Function("translate", 2))
-
-  val dateScalarFunc: Seq[Function] =
-    Seq(Function("year", 1), Function("hour", 1), Function("minute", 1), 
Function("second", 1))
+  private def createFunctionWithInputs(name: String, inputs: Seq[SparkType]): 
Function = {
+    Function(name, Seq(FunctionSignature(inputs)))
+  }
 
+  private def createFunctions(name: String, signatures: 
Seq[FunctionSignature]): Function = {
+    Function(name, signatures)
+  }
+
+  private def createUnaryStringFunction(name: String): Function = {
+    createFunctionWithInputs(name, Seq(SparkStringType))
+  }
+
+  private def createUnaryNumericFunction(name: String): Function = {
+    createFunctionWithInputs(name, Seq(SparkNumericType))
+  }
+
+  // Math expressions (corresponds to mathExpressions in QueryPlanSerde)
   val mathScalarFunc: Seq[Function] = Seq(

Review Comment:
   perhaps we can validate that expressions in `QueryPlanSerde` not covered by 
fuzzer? it would help us having a consistent functions set we fuzz testing 
especially if a person added a new function



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to