cyrilou242 commented on PR #12643:
URL: https://github.com/apache/pinot/pull/12643#issuecomment-1997130131

   nice thanks! 
   Does this work as expected for? 
   ```
   DISTINCTCOUNTHLL(CASE WHEN x='foo' THEN y ELSE '' END)
   ```
   
   Ie 
   ```
   DISTINCTCOUNTHLL(CASE WHEN x='foo' THEN y END)
   ```
   can be transformed in 
   ```
   DISTINCTCOUNTHLL(y) FILTER(WHERE x = 'foo')
   ```
   
   But 
   ```
   DISTINCTCOUNTHLL(CASE WHEN x='foo' THEN y ELSE '' END)
   ```
   Should not be transformed because the ELSE case corresponds to a potential 
+1 in the count that cannot be expressed with the filter.
   
   
   It's implemented here: 
   
https://github.com/apache/calcite/blob/f0dc2b0aea46b1fd3f37e0cc126edaf82ade2344/core/src/main/java/org/apache/calcite/rel/rules/AggregateCaseToFilterRule.java#L179
   
   Just want to make sure 
   `aggregateCall.isDistinct()` returns true when the aggregateCal is 
`DISTINCTCOUNTHLL` or a similar distinct aggregation function.
   
   I'll check myself.
   
   


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