jayzhan211 commented on PR #11897:
URL: https://github.com/apache/datafusion/pull/11897#issuecomment-2283134884

   > I was doing similar optimize things in the begining, but after alamb asked 
me to add tests when having is true. I found out this problem.
   
   What problem do you have if you try rewriting expr? This is what I'm not 
clear at.
   
   This is the normal case we have, we handle edge case in accumulator
   `select avg(a) from t group by b`
   
   If group by is `true` or `false`.
   `select avg(a) from t group by false having false`, we rewrite it to 
EmptyRelation
   
   If having is false, we returns empty set (by rewritten to EmptyRelation), if 
having is true, we returns Null (not clear to me).
   
   Given the example you gave above, 
   
   > when having is true and group_by is a constant
   
   I think we can rewrite it to `EmptyRelation`, group by with constant other 
than `true` and `false` seems not a valid query.
   


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