vladimirg-db opened a new pull request, #56202:
URL: https://github.com/apache/spark/pull/56202

   ### What changes were proposed in this pull request?
   
   This PR extends `group-analytics.sql` with additional query-level coverage 
for GROUPING SETS / CUBE / ROLLUP, exercising scenarios that were previously 
under-covered:
   
   - `grouping_id()` (no-arg and explicit-arg) across GROUPING SETS, CUBE, and 
ROLLUP.
   - Lateral column aliases that reference `grouping()` / `grouping_id()` 
results.
   - Aggregate functions in `HAVING` and `ORDER BY` over grouping analytics 
(including rolled-up groups and aggregate arguments that are also grouping 
keys).
   - Expression grouping keys, `SELECT *` with CUBE, and ordinal references 
inside ROLLUP / GROUPING SETS.
   - Struct field access inside aggregates over grouping analytics.
   - Scalar / EXISTS / NOT IN subqueries combined with grouping analytics.
   
   The input data is defined as temporary views and each query is formatted 
multi-line for readability.
   
   ### Why are the changes needed?
   
   These combinations (notably aggregate functions in HAVING/ORDER BY over 
rolled-up groups, lateral column aliases over grouping functions, and struct 
field access) were not covered by the existing golden tests. Locking down the 
current, correct behavior guards against regressions.
   
   ### Does this PR introduce any user-facing change?
   
   No. Test-only change.
   
   ### How was this patch tested?
   
   Golden files regenerated with
   `SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "sql/testOnly 
org.apache.spark.sql.SQLQueryTestSuite -- -z group-analytics.sql"` and the 
suite passes.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Yes.
   
   Co-authored-by: Claude
   


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