Jesus Camacho Rodriguez created HIVE-17716: ----------------------------------------------
Summary: Not pushing postaggregations into Druid due to CAST on constant Key: HIVE-17716 URL: https://issues.apache.org/jira/browse/HIVE-17716 Project: Hive Issue Type: Bug Components: Druid integration Reporter: Jesus Camacho Rodriguez Assignee: Jesus Camacho Rodriguez After Calcite is upgraded to 1.14 and the rule to push post-aggregations to Druid is enabled, the following query fails to create a postaggregation: {code} EXPLAIN SELECT language, sum(added) + 100 AS a FROM druid_table_1 GROUP BY language ORDER BY a DESC; {code} Problem seems to be that CAST is getting on the way for the rule to be applied. In particular, this is the final Calcite plan: {code} HiveSortLimit(sort0=[$1], dir0=[DESC-nulls-last]) HiveProject(language=[$0], a=[+($1, CAST(100):DOUBLE)]) DruidQuery(table=[[default.druid_table_1]], intervals=[[1900-01-01T00:00:00.000/3000-01-01T00:00:00.000]], groups=[{6}], aggs=[[sum($10)]]) {code} There are two different parts to explore to seek a solution: 1) why {{CAST(100):DOUBLE)}} is not folded to {{100.0d}}, and 2) whether the rule to push post-aggregations to Druid could handle the CAST in some particular cases. -- This message was sent by Atlassian JIRA (v6.4.14#64029)