Copilot commented on code in PR #12242:
URL: https://github.com/apache/gluten/pull/12242#discussion_r3357569332


##########
gluten-ut/spark41/src/test/scala/org/apache/spark/sql/GlutenBitmapExpressionsQuerySuite.scala:
##########
@@ -37,4 +37,17 @@ class GlutenBitmapExpressionsQuerySuite
       "Expected native HashAggregateExecBaseTransformer in plan"
     )
   }
+
+  test("bitmap_or_agg routes to native") {
+    val df = spark.sql(
+      "SELECT bitmap_or_agg(bitmap_construct_agg(bitmap_bit_position(col))) " +
+        "FROM values (1L), (2L), (3L) AS t(col)")
+    df.collect()

Review Comment:
   `bitmap_construct_agg` appears to be an aggregate function, and Spark SQL 
does not allow nesting aggregate functions inside another aggregate 
(`bitmap_or_agg(bitmap_construct_agg(...))`) in the same aggregation level. 
This query is likely to fail analysis with a nested-aggregate error. Consider 
rewriting the SQL to avoid nested aggregates (e.g., compute 
`bitmap_construct_agg(...)` in a subquery / CTE, or feed `bitmap_or_agg` with a 
non-aggregate bitmap expression), and apply the same fix to the equivalent 
tests in the Spark 3.5 and 4.0 suites.



##########
cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc:
##########
@@ -1324,7 +1324,8 @@ bool SubstraitToVeloxPlanValidator::validate(const 
::substrait::AggregateRel& ag
       "regr_intercept",
       "regr_sxy",
       "regr_replacement",
-      "bitmap_construct_agg"};
+      "bitmap_construct_agg",
+      "bitmap_or_agg"};

Review Comment:
   The PR excludes the `bitmap_or_agg routes to native` test for Velox because 
the native Velox function is “not yet available”, but the Velox plan validator 
now whitelists `"bitmap_or_agg"` as a supported aggregate. This mismatch can 
cause plans using `bitmap_or_agg` to be incorrectly validated as executable on 
Velox (potentially preventing fallback) even though the backend can’t run it 
yet. Recommended fix: remove `"bitmap_or_agg"` from this supported list until 
Velox support lands, or gate it based on actual UDAF registration / feature 
flag so validation matches runtime capability.



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