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:
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:
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.
|handle UDF to double/int over aggregate||Resolved|