yadavay-amzn commented on code in PR #56417:
URL: https://github.com/apache/spark/pull/56417#discussion_r3445588932


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ExprUtils.scala:
##########
@@ -217,7 +217,14 @@ object ExprUtils extends EvalHelper with QueryErrorsBase {
       }
     }
 
-    a.groupingExpressions.foreach(checkValidGroupingExprs)
+    // Skip grouping-expression validation when unexpanded BaseGroupingSets 
are present:
+    // calling .dataType on them would throw. They are validated 
post-expansion instead.
+    // Aggregate-expression validation (nested agg, missing group-by, etc.) 
still runs.
+    val skipGroupingChecks =

Review Comment:
   Thanks, shrirang; agreed. Made the skip an explicit `skipGroupingExprChecks: 
Boolean = false` parameter on `assertValidAggregation`, so all callers retain 
the grouping-expression checks by default and only opt out deliberately.
   
   While doing this the main single-pass path ended up stronger than a plain 
skip: `AggregateResolver` now expands the grouping sets before validation, so 
the full checks (type-is-orderable, no nested aggregates in grouping) run on 
the expanded `Aggregate` rather than being skipped. The only caller passing 
`true` is the `LateralColumnAliasResolver` defense-in-depth path, which is 
unreachable today (`AggregateResolver` raises 
`ExplicitlyUnsupportedResolverFeature` first) and is commented as such. So a 
future caller cannot silently lose the checks; the contract is now explicit and 
on by default.



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