cfmcgrady commented on code in PR #2481:
URL: https://github.com/apache/datafusion-comet/pull/2481#discussion_r2391538980


##########
spark/src/test/scala/org/apache/comet/CometArrayExpressionSuite.scala:
##########
@@ -699,11 +755,48 @@ class CometArrayExpressionSuite extends CometTestBase 
with AdaptiveSparkPlanHelp
       CometConf.COMET_EXPLAIN_FALLBACK_ENABLED.key -> "true") {
       Seq(true, false).foreach { dictionaryEnabled =>
         withTempDir { dir =>
-          val path = new Path(dir.toURI.toString, "test.parquet")
-          makeParquetFileAllPrimitiveTypes(path, dictionaryEnabled, 100)
-          spark.read.parquet(path.toString).createOrReplaceTempView("t1")
-          checkSparkAnswerAndOperator(
-            sql("SELECT array(array(1, 2, 3), null, array(), array(null), 
array(1)) from t1"))
+          withTempView("t1") {
+            val path = new Path(dir.toURI.toString, "test.parquet")
+            makeParquetFileAllPrimitiveTypes(path, dictionaryEnabled, 100)
+            spark.read.parquet(path.toString).createOrReplaceTempView("t1")
+            checkSparkAnswerAndOperator(
+              sql("SELECT array(array(1, 2, 3), null, array(), array(null), 
array(1)) from t1"))
+          }
+        }
+      }
+    }
+  }
+
+  test("array_reverse") {
+    withTempDir { dir =>
+      val path = new Path(dir.toURI.toString, "test.parquet")
+      val filename = path.toString
+      val random = new Random(42)
+      withSQLConf(CometConf.COMET_ENABLED.key -> "false") {
+        val options = DataGenOptions(
+          allowNull = true,
+          generateNegativeZero = true,
+          generateArray = true,
+          generateStruct = true,
+          generateMap = false)
+        ParquetGenerator.makeParquetFile(random, spark, filename, 100, options)
+      }
+      withSQLConf(
+        CometConf.COMET_NATIVE_SCAN_ENABLED.key -> "false",
+        CometConf.COMET_SPARK_TO_ARROW_ENABLED.key -> "true",
+        CometConf.COMET_CONVERT_FROM_PARQUET_ENABLED.key -> "true") {
+        withTempView("t1", "t2") {
+          val table = spark.read.parquet(filename)
+          table.createOrReplaceTempView("t1")
+          val fieldNames =
+            table.schema.fields
+              .filter(filed => 
CometArrayReverse.isTypeSupported(filed.dataType))
+              .map(_.name)
+          for (fieldName <- fieldNames) {
+            sql(s"SELECT $fieldName as a FROM t1")
+              .createOrReplaceTempView("t2")
+            checkSparkAnswer(sql("SELECT reverse(a) FROM t2"))

Review Comment:
   The `CometStringExpressionSuite` file contains a unit test for the `reverse` 
function with a string input.
   
   
https://github.com/apache/datafusion-comet/blob/8295024e8ac04204d47675a15a838fe4a3d26027/spark/src/test/scala/org/apache/comet/CometStringExpressionSuite.scala#L166-L175



-- 
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