dilipbiswal commented on issue #24209: [SPARK-27255][SQL] Aggregate functions 
should not be allowed in WHERE
URL: https://github.com/apache/spark/pull/24209#issuecomment-476454709
 
 
   @cloud-fan I checked the code. The validation for presence of window 
expression(s) in filter and having is done in analyzer in rule 
`ExtractWindowExpressions`. I don't know about the difficulty in doing the 
check in checkAnalysis. Perhaps, we run into issues while processing the window 
expression later on in analyzer. 
   
   However, for our current case, i think it makes sense to do it in 
checkAnalysis since HAVING can have aggregate and is planned as a Filter. I 
think somewhere in Analyzer we turn this into a Filter over Aggregate with 
Filter referencing to the output of Aggregate as a named expression. So after 
we do all that work, when we come to checkAnalysis and we still have aggregate 
expressions in the Filter node, we raise the error.  Please let me know ..

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to