pan3793 commented on PR #44352:
URL: https://github.com/apache/spark/pull/44352#issuecomment-1860450330

   > I think in Spark the extension is we can push down grouping expressions 
and aggregate functions from ORDER BY to SELECT.
   
   @cloud-fan I believe Spark already supports it when HVAING is absent, but 
does not work if HAVING is present, that why I say "maybe we can call it a 
bugfix"
   
   ```patch
     SELECT xxx
     FROM xxx
     GROUP BY xxx
   + HAVING xxx
     ORDER BY xxx
   ```
   
   >  It seems we have an optimization that if the ORDER BY expression directly 
matches something from the SELECT list, we replace it with `AttributReference`. 
Can you find out where the optimization is? And when it will be triggered? Is 
there rule-order independent?
   
   Let me try.


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