gortiz opened a new pull request, #12643: URL: https://github.com/apache/pinot/pull/12643
This PR adds a rule that transforms queries like `SELECT SUM(CASE WHEN col1 = 'a' THEN 1 ELSE 0 END) FROM a` into `SELECT SUM(1) FILTER (WHERE col1 = 'a') from a`. A test is added to verify explain is compatible, although in that case more optimizations are applied and we ended up executing something like `SELECT COUNT(col1) from a where col1 = 'a'` We think this optimization should be effective in most of the cases, specially applying indexes, although it may be some situations where the result is worse than expected because `FILTER` is sometimes slower than `CASE`. We plan to add in a future an option or hint to indicate Pinot to do not apply this (and other) optimizations. -- 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]
