asolimando commented on issue #18399:
URL: https://github.com/apache/datafusion/issues/18399#issuecomment-3472572336

   Conceptually speaking there is no difference with any filter-aggregate 
transpose (because at the end of the day, dynamic filter is just a filter at 
the algebraic level), so whatever is level there, it's legal here.
   
   If we take for guidance Apache Calcite's 
[FilterAggregateTransposeRule.java](https://github.com/apache/calcite/blob/34989b0ed7793cedf713c2f159de6247a730458c/core/src/main/java/org/apache/calcite/rel/rules/FilterAggregateTransposeRule.java#L89)
 which is battle-tested, we can see that it blocks the transpose/pushdown if: 
   
   1. group by is empty (e.g., `SELECT COUNT(*)`)
   2. the filter references aggregate results (what @fmonjalet is suggesting, 
basically)
   3. when there are multiple grouping sets, the filtered columns must be in 
all of them
   
   All the other cases can be considered safe IMO, happy to hear your thoughts 
on this!


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