Class ConvertCountToDirectScanRule

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

public class ConvertCountToDirectScanRule extends org.apache.calcite.plan.RelOptRule

This rule is a logical planning counterpart to a corresponding ConvertCountToDirectScanPrule physical rule

This rule will convert " select count(*) as mycount from table " or " select count(not-nullable-expr) as mycount from table " into

    Project(mycount)
         \
    DirectGroupScan ( PojoRecordReader ( rowCount ))
or " select count(column) as mycount from table " into
      Project(mycount)
           \
            DirectGroupScan (PojoRecordReader (columnValueCount))
Rule can be applied if query contains multiple count expressions. " select count(column1), count(column2), count(*) from table "

The rule utilizes the Parquet Metadata Cache's summary information to retrieve the total row count and the per-column null count. As such, the rule is only applicable for Parquet tables and only if the metadata cache has been created with the summary information.

  • 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
    static final org.apache.calcite.plan.RelOptRule
     
    static final org.apache.calcite.plan.RelOptRule
     

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

    description, operands, relBuilderFactory
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onMatch(org.apache.calcite.plan.RelOptRuleCall call)
     

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

    any, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, 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

    • AGG_ON_PROJ_ON_SCAN

      public static final org.apache.calcite.plan.RelOptRule AGG_ON_PROJ_ON_SCAN
    • AGG_ON_SCAN

      public static final org.apache.calcite.plan.RelOptRule AGG_ON_SCAN
  • Method Details

    • onMatch

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