Class RelDecorrelator.RemoveSingleAggregateRule

Enclosing class:
RelDecorrelator

public static final class RelDecorrelator.RemoveSingleAggregateRule extends RelRule<RelDecorrelator.RemoveSingleAggregateRule.RemoveSingleAggregateRuleConfig>
Rule to remove an Aggregate with SINGLE_VALUE. For cases like:

 Aggregate(SINGLE_VALUE)
   Project(single expression)
     Aggregate
 

For instance, the following subtree from TPCH query 17:


 LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])
   LogicalProject(EXPR$0=[*(0.2:DECIMAL(2, 1), $0)])
     LogicalAggregate(group=[{}], agg#0=[AVG($0)])
       LogicalProject(L_QUANTITY=[$4])
         LogicalFilter(condition=[=($1, $cor0.P_PARTKEY)])
           LogicalTableScan(table=[[TPCH_01, LINEITEM]])
 

will be converted into:


 LogicalProject($f0=[*(0.2:DECIMAL(2, 1), $0)])
   LogicalAggregate(group=[{}], agg#0=[AVG($0)])
     LogicalProject(L_QUANTITY=[$4])
       LogicalFilter(condition=[=($1, $cor0.P_PARTKEY)])
         LogicalTableScan(table=[[TPCH_01, LINEITEM]])