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

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

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

    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

    description, operands, relBuilderFactory
  • Constructor Summary

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

    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

    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

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

    • INSTANCE

      public static final DrillReduceAggregatesRule INSTANCE
      The singleton.
    • INSTANCE_SUM

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

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

    • DrillReduceAggregatesRule

      protected DrillReduceAggregatesRule(org.apache.calcite.plan.RelOptRuleOperand operand)
  • 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 ruleCall)
      Specified by:
      onMatch in class org.apache.calcite.plan.RelOptRule
    • newAggregateRel

      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.