Class PushLocalSortAggWithSortIntoScanRule

java.lang.Object
org.apache.calcite.plan.RelOptRule
org.apache.flink.table.planner.plan.rules.physical.batch.PushLocalAggIntoScanRuleBase
org.apache.flink.table.planner.plan.rules.physical.batch.PushLocalSortAggWithSortIntoScanRule

public class PushLocalSortAggWithSortIntoScanRule extends PushLocalAggIntoScanRuleBase
Planner rule that tries to push a local sort aggregate which with sort into a BatchPhysicalTableSourceScan whose table is a TableSourceTable with a source supporting SupportsAggregatePushDown.

Suppose we have the original physical plan:


 BatchPhysicalSortAggregate (global)
 +- BatchPhysicalSort (exists if group keys are not empty)
    +- BatchPhysicalExchange (hash by group keys if group keys is not empty, else singleton)
       +- BatchPhysicalLocalSortAggregate (local)
          +- BatchPhysicalSort (exists if group keys are not empty)
             +- BatchPhysicalTableSourceScan
 

This physical plan will be rewritten to:


 BatchPhysicalSortAggregate (global)
 +- BatchPhysicalSort (exists if group keys are not empty)
    +- BatchPhysicalExchange (hash by group keys if group keys is not empty, else singleton)
       +- BatchPhysicalTableSourceScan (with local aggregate pushed down)
 
  • Field Details

  • Constructor Details

    • PushLocalSortAggWithSortIntoScanRule

      public PushLocalSortAggWithSortIntoScanRule()
  • Method Details

    • matches

      public boolean matches(org.apache.calcite.plan.RelOptRuleCall call)
      Overrides:
      matches in class org.apache.calcite.plan.RelOptRule
    • onMatch

      public void onMatch(org.apache.calcite.plan.RelOptRuleCall call)
      Specified by:
      onMatch in class org.apache.calcite.plan.RelOptRule