benkrug opened a new issue #10557: URL: https://github.com/apache/druid/issues/10557
Please provide a detailed title (e.g. "Broker crashes when using TopN query with Bound filter" instead of just "Broker crashes"). ### Affected Version Observed in 0.18 ### Description Something's going wrong with the translation for a SQL query using an inner query with a CASE, and an outer query with aggregation on a field from the inner query (from the case) and filtering on the same field. Eg, this query returns 41 rows from the wikipedia sample data set: ``` select (summ_added) from (select case when sum(sum_added) > 10000 then sum(sum_added) else -1 end as summ_added, channel from wikipedia group by 2) where summ_added > -1 ``` But trying to get avg, sum, or count of (summ_added) returns no data - eg ``` select count(summ_added) from (select case when sum(sum_added) > 10000 then sum(sum_added) else -1 end as summ_added, channel from wikipedia group by 2) where summ_added > -1 ``` This doesn't happen if there's no CASE usage. Eg, ``` select (summ_added) from (select sum(sum_added) as summ_added, channel from wikipedia group by 2) where summ_added > -1 ``` returns 51 rows, and ``` select count(summ_added) from (select sum(sum_added) as summ_added, channel from wikipedia group by 2) where summ_added > -1 ``` returns 51. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
