parthchandra commented on code in PR #2994:
URL: https://github.com/apache/datafusion-comet/pull/2994#discussion_r2663281983


##########
spark/src/test/scala/org/apache/comet/rules/CometExecRuleSuite.scala:
##########
@@ -173,14 +175,42 @@ class CometExecRuleSuite extends CometTestBase {
         CometConf.COMET_EXEC_LOCAL_TABLE_SCAN_ENABLED.key -> "true") {
         val transformedPlan = applyCometExecRule(sparkPlan)
 
-        // if the partial aggregate cannot be converted to Comet, then neither 
should be
+        // SUM is not safe for mixed execution, so both partial and final 
should fall back
         assert(
           countOperators(transformedPlan, classOf[HashAggregateExec]) == 
originalHashAggCount)
         assert(countOperators(transformedPlan, 
classOf[CometHashAggregateExec]) == 0)
       }
     }
   }
 
+  test("CometExecRule should allow Spark partial and Comet final for safe 
aggregates") {
+    // https://github.com/apache/datafusion-comet/issues/2894
+    // MIN, MAX, COUNT are safe for mixed execution (simple intermediate 
buffer)
+    withTempView("test_data") {
+      createTestDataFrame.createOrReplaceTempView("test_data")
+
+      val sparkPlan =
+        createSparkPlan(
+          spark,
+          "SELECT MIN(id), MAX(id), COUNT(*) FROM test_data GROUP BY (id % 3)")

Review Comment:
   It would be nice to add cases for the bit*** functions as well



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