viirya commented on code in PR #802:
URL: https://github.com/apache/datafusion-comet/pull/802#discussion_r1720416743


##########
spark/src/test/scala/org/apache/comet/exec/CometExecSuite.scala:
##########
@@ -1564,14 +1564,72 @@ class CometExecSuite extends CometTestBase {
     }
   }
 
+  test("aggregate window function for all types") {
+    val numValues = 2048
+
+    Seq(1, 100, numValues).foreach { numGroups =>
+      Seq(true, false).foreach { dictionaryEnabled =>
+        withTempPath { dir =>
+          val path = new Path(dir.toURI.toString, "test.parquet")
+          makeParquetFile(path, numValues, numGroups, dictionaryEnabled)
+          withParquetTable(path.toUri.toString, "tbl") {
+            Seq(128, numValues + 100).foreach { batchSize =>
+              withSQLConf(CometConf.COMET_BATCH_SIZE.key -> 
batchSize.toString) {
+                (1 to 11).foreach { col =>
+                  val aggregateFunctions =
+                    List(s"COUNT(_$col)", s"MAX(_$col)", s"MIN(_$col)", 
s"SUM(_$col)")
+                  aggregateFunctions.foreach { function =>
+                    val df1 = sql(s"SELECT $function OVER() FROM tbl")
+                    checkSparkAnswerWithTol(df1, 1e-6)
+
+                    val df2 = sql(s"SELECT $function OVER(order by _2) FROM 
tbl")
+                    checkSparkAnswerWithTol(df2, 1e-6)
+
+                    val df3 = sql(s"SELECT $function OVER(order by _2 desc) 
FROM tbl")
+                    checkSparkAnswerWithTol(df3, 1e-6)
+
+                    val df4 = sql(s"SELECT $function OVER(partition by _2 
order by _2) FROM tbl")
+                    checkSparkAnswerWithTol(df4, 1e-6)
+                  }
+                }
+
+                // SUM doesn't work for Date type. 
org.apache.spark.sql.AnalysisException will be thrown.

Review Comment:
   Is it because DataFusion doesn't support it?



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to