Class PushLocalAggIntoScanRuleBase

java.lang.Object
org.apache.calcite.plan.RelOptRule
org.apache.flink.table.planner.plan.rules.physical.batch.PushLocalAggIntoScanRuleBase
Direct Known Subclasses:
PushLocalHashAggIntoScanRule, PushLocalHashAggWithCalcIntoScanRule, PushLocalSortAggIntoScanRule, PushLocalSortAggWithCalcIntoScanRule, PushLocalSortAggWithSortAndCalcIntoScanRule, PushLocalSortAggWithSortIntoScanRule

public abstract class PushLocalAggIntoScanRuleBase extends org.apache.calcite.plan.RelOptRule
Planner rule that tries to push a local aggregator into an BatchPhysicalTableSourceScan whose table is a TableSourceTable with a source supporting SupportsAggregatePushDown.

The aggregate push down does not support a number of more complex statements at present:

  • complex grouping operations such as ROLLUP, CUBE, or GROUPING SETS.
  • expressions inside the aggregation function call: such as sum(a * b).
  • aggregations with ordering.
  • aggregations with filter.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.calcite.plan.RelOptRule

    org.apache.calcite.plan.RelOptRule.ConverterRelOptRuleOperand
  • Field Summary

    Fields inherited from class org.apache.calcite.plan.RelOptRule

    description, operands, relBuilderFactory
  • Constructor Summary

    Constructors
    Constructor
    Description
    PushLocalAggIntoScanRuleBase(org.apache.calcite.plan.RelOptRuleOperand operand, String description)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    canPushDown(BatchPhysicalGroupAggregateBase aggregate, BatchPhysicalTableSourceScan tableSourceScan, BatchPhysicalCalc calc)
     
    protected int[]
    getRefFiledIndex(BatchPhysicalCalc calc)
     
    protected boolean
    isInputRefOnly(BatchPhysicalCalc calc)
    Currently, we only supports to push down aggregate above calc which has input ref only.
    protected boolean
    isProjectionNotPushedDown(BatchPhysicalTableSourceScan tableSourceScan)
     
    protected void
    pushLocalAggregateIntoScan(org.apache.calcite.plan.RelOptRuleCall call, BatchPhysicalGroupAggregateBase localAgg, BatchPhysicalTableSourceScan oldScan, BatchPhysicalCalc calc)
     
    protected List<org.apache.calcite.rel.core.AggregateCall>
    translateAggCallArgIndex(List<org.apache.calcite.rel.core.AggregateCall> aggCallList, int[] refFields)
     
    protected List<int[]>
    translateGroupingArgIndex(List<int[]> groupingSets, int[] refFields)
     

    Methods inherited from class org.apache.calcite.plan.RelOptRule

    any, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, none, onMatch, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PushLocalAggIntoScanRuleBase

      public PushLocalAggIntoScanRuleBase(org.apache.calcite.plan.RelOptRuleOperand operand, String description)
  • Method Details

    • canPushDown

      protected boolean canPushDown(BatchPhysicalGroupAggregateBase aggregate, BatchPhysicalTableSourceScan tableSourceScan, @Nullable BatchPhysicalCalc calc)
    • pushLocalAggregateIntoScan

      protected void pushLocalAggregateIntoScan(org.apache.calcite.plan.RelOptRuleCall call, BatchPhysicalGroupAggregateBase localAgg, BatchPhysicalTableSourceScan oldScan, @Nullable BatchPhysicalCalc calc)
    • isProjectionNotPushedDown

      protected boolean isProjectionNotPushedDown(BatchPhysicalTableSourceScan tableSourceScan)
    • isInputRefOnly

      protected boolean isInputRefOnly(BatchPhysicalCalc calc)
      Currently, we only supports to push down aggregate above calc which has input ref only.
      Parameters:
      calc - BatchPhysicalCalc
      Returns:
      true if OK to be pushed down
    • getRefFiledIndex

      protected int[] getRefFiledIndex(BatchPhysicalCalc calc)
    • translateGroupingArgIndex

      protected List<int[]> translateGroupingArgIndex(List<int[]> groupingSets, int[] refFields)
    • translateAggCallArgIndex

      protected List<org.apache.calcite.rel.core.AggregateCall> translateAggCallArgIndex(List<org.apache.calcite.rel.core.AggregateCall> aggCallList, int[] refFields)