beliefer opened a new pull request #29382:
URL: https://github.com/apache/spark/pull/29382


   ### What changes were proposed in this pull request?
   Spark SQL supported filter clause in aggregate, for example:
   select sum(distinct id) filter (where sex = 'man') from student;
   But sometimes we can eliminate the filter clause in aggregate.
   `SELECT COUNT(DISTINCT 1) FILTER (WHERE true) FROM testData;`
   could be transformed to
   `SELECT COUNT(DISTINCT 1) FROM testData;`
   `SELECT COUNT(DISTINCT 1) FILTER (WHERE false) FROM testData;`
   could be transformed to
   `SELECT 0 FROM testData;`
   
   
   ### Why are the changes needed?
   Optimize the filter clause in aggregation
   
   
   ### Does this PR introduce _any_ user-facing change?
   'No'.
   
   
   ### How was this patch tested?
   New test.
   


----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to