[ 
https://issues.apache.org/jira/browse/SPARK-57346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18087730#comment-18087730
 ] 

Anupam Yadav edited comment on SPARK-57346 at 6/9/26 7:06 PM:
--------------------------------------------------------------

[~stefan.kandic]  I'd like to work on this if that's okay with you. Thanks!


was (Author: JIRAUSER312999):
I'd like to work on this. Thanks!

> [Analyzer++] HAVING/ORDER BY aggregates over GROUPING SETS give wrong results
> -----------------------------------------------------------------------------
>
>                 Key: SPARK-57346
>                 URL: https://issues.apache.org/jira/browse/SPARK-57346
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 4.2.0
>            Reporter: Stefan Kandic
>            Priority: Major
>
> SUM(b) in HAVING/ORDER BY above a GROUPING SETS/CUBE/ROLLUP aggregate 
> resolves grouping column b to the Expand-output copy (NULL for rolled-up 
> groups) instead of the original column. HAVING filters out rolled-up rows; 
> ORDER BY sorts them as NULL.
> ORDER BY repro: 
> SELECT a, b, SUM(b) FROM VALUES (1,10),(1,20),(2,30) AS t(a,b)
> GROUP BY CUBE(a, b) ORDER BY SUM(b);                          
>                                                                               
>                
> HAVING repro:                                                                 
>              
> SELECT a, SUM(b) FROM VALUES (1,10),(1,20),(2,30) AS t(a,b)                   
>              
> GROUP BY ROLLUP(a, b) HAVING SUM(b) > 25;



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to