For the following query which has a filter on top of an aggregation, Drill's currently push the filter pass through the aggregation. As a result, we may miss some optimization opportunity. For instance, such filter could potentially been pushed into scan if it qualifies for partition pruning.
For the following query:
The current plan shows a filter (00-04) on top of aggregation(00-05). The better plan would have the filter pushed pass the aggregation.
The root cause of this problem is Drill's ruleset does not include FilterAggregateTransoposeRule from Calcite library.