Class DrillReduceAggregatesRule

java.lang.Object
org.apache.calcite.plan.RelOptRule
org.apache.drill.exec.planner.logical.DrillReduceAggregatesRule

public class DrillReduceAggregatesRule extends org.apache.calcite.plan.RelOptRule
Rule to reduce aggregates to simpler forms. Currently only AVG(x) to SUM(x)/COUNT(x), but eventually will handle others such as STDDEV.
  • Nested Class Summary Link icon

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

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

    Fields
    Modifier and Type
    Field
    Description
    The singleton.
    static final org.apache.drill.exec.planner.logical.DrillReduceAggregatesRule.DrillConvertSumToSumZero
     
    static final org.apache.drill.exec.planner.logical.DrillReduceAggregatesRule.DrillConvertWindowSumToSumZero
     

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

    description, operands, relBuilderFactory
  • Constructor Summary Link icon

    Constructors
    Modifier
    Constructor
    Description
    protected
    DrillReduceAggregatesRule(org.apache.calcite.plan.RelOptRuleOperand operand)
     
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    boolean
    matches(org.apache.calcite.plan.RelOptRuleCall call)
     
    protected org.apache.calcite.rel.core.Aggregate
    newAggregateRel(org.apache.calcite.rel.core.Aggregate oldAggRel, org.apache.calcite.rel.RelNode inputRel, List<org.apache.calcite.rel.core.AggregateCall> newCalls)
    Do a shallow clone of oldAggRel and update aggCalls.
    void
    onMatch(org.apache.calcite.plan.RelOptRuleCall ruleCall)
     

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

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

    Methods inherited from class java.lang.Object Link icon

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details Link icon

    • INSTANCE Link icon

      public static final DrillReduceAggregatesRule INSTANCE
      The singleton.
    • INSTANCE_SUM Link icon

      public static final org.apache.drill.exec.planner.logical.DrillReduceAggregatesRule.DrillConvertSumToSumZero INSTANCE_SUM
    • INSTANCE_WINDOW_SUM Link icon

      public static final org.apache.drill.exec.planner.logical.DrillReduceAggregatesRule.DrillConvertWindowSumToSumZero INSTANCE_WINDOW_SUM
  • Constructor Details Link icon

    • DrillReduceAggregatesRule Link icon

      protected DrillReduceAggregatesRule(org.apache.calcite.plan.RelOptRuleOperand operand)
  • Method Details Link icon

    • matches Link icon

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

      public void onMatch(org.apache.calcite.plan.RelOptRuleCall ruleCall)
      Specified by:
      onMatch in class org.apache.calcite.plan.RelOptRule
    • newAggregateRel Link icon

      protected org.apache.calcite.rel.core.Aggregate newAggregateRel(org.apache.calcite.rel.core.Aggregate oldAggRel, org.apache.calcite.rel.RelNode inputRel, List<org.apache.calcite.rel.core.AggregateCall> newCalls)
      Do a shallow clone of oldAggRel and update aggCalls. Could be refactored into Aggregate and subclasses - but it's only needed for some subclasses.
      Parameters:
      oldAggRel - AggregateRel to clone.
      inputRel - Input relational expression
      newCalls - New list of AggregateCalls
      Returns:
      shallow clone with new list of AggregateCalls.