gianm opened a new pull request, #19063: URL: https://github.com/apache/druid/pull/19063
Fixes #17768. Previously, when `extendedFilteredSumRewrite: true` (the default), the aggregator `SUM(CASE WHEN COND THEN COL1 ELSE 0 END)` would be planned into `SUM(COL1) FILTER(WHERE COND)`. This creates a discrepancy in the situation where the underlying relation is nonempty but COND does not match any rows: SQL standard behavior is for the aggregator to return zero, but we returned NULL. This patch fixes it by wrapping such aggregators in `COALESCE(_, CASE WHEN COUNT(*) > 0 THEN 0 END)`. -- 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]
