Class DrillPushProjectIntoScanRule

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

public class DrillPushProjectIntoScanRule extends org.apache.calcite.plan.RelOptRule
When table support project push down, rule can be applied to reduce number of read columns thus improving scan operator performance.
  • 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
     
    static final org.apache.calcite.plan.RelOptRule
     

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

    description, operands, relBuilderFactory
  • Constructor Summary

    Constructors
    Constructor
    Description
    DrillPushProjectIntoScanRule(Class<? extends org.apache.calcite.rel.core.Project> projectClass, Class<? extends org.apache.calcite.rel.core.TableScan> scanClass, String description)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    canPushProjectIntoScan(org.apache.calcite.plan.RelOptTable table, DrillRelOptUtil.ProjectPushInfo projectPushInfo)
    Push project into scan be done only if this is not a star query and table supports project push down.
    protected org.apache.calcite.rel.core.Project
    createProject(org.apache.calcite.rel.core.Project project, org.apache.calcite.rel.core.TableScan newScan, List<org.apache.calcite.rex.RexNode> newProjects)
    Creates new DrillProjectRelBase instance with specified TableScan newScan child and List<RexNode> newProjects expressions using specified Project project as prototype.
    protected org.apache.calcite.rel.core.TableScan
    createScan(org.apache.calcite.rel.core.TableScan scan, DrillRelOptUtil.ProjectPushInfo projectPushInfo)
    Creates new DrillScanRelBase instance with row type and fields list obtained from specified ProjectPushInfo projectPushInfo using specified TableScan scan as prototype.
    void
    onMatch(org.apache.calcite.plan.RelOptRuleCall call)
     
    protected boolean
    skipScanConversion(org.apache.calcite.rel.type.RelDataType projectRelDataType, org.apache.calcite.rel.core.TableScan scan)
    Checks whether conversion of input TableScan instance to target TableScan may be omitted.

    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

    • INSTANCE

      public static final org.apache.calcite.plan.RelOptRule INSTANCE
    • DRILL_LOGICAL_INSTANCE

      public static final org.apache.calcite.plan.RelOptRule DRILL_LOGICAL_INSTANCE
    • DRILL_PHYSICAL_INSTANCE

      public static final org.apache.calcite.plan.RelOptRule DRILL_PHYSICAL_INSTANCE
  • Constructor Details

    • DrillPushProjectIntoScanRule

      public DrillPushProjectIntoScanRule(Class<? extends org.apache.calcite.rel.core.Project> projectClass, Class<? extends org.apache.calcite.rel.core.TableScan> scanClass, String description)
  • Method Details

    • onMatch

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

      protected boolean skipScanConversion(org.apache.calcite.rel.type.RelDataType projectRelDataType, org.apache.calcite.rel.core.TableScan scan)
      Checks whether conversion of input TableScan instance to target TableScan may be omitted.
      Parameters:
      projectRelDataType - project rel data type
      scan - TableScan to be checked
      Returns:
      true if specified TableScan has the same row type as specified.
    • createProject

      protected org.apache.calcite.rel.core.Project createProject(org.apache.calcite.rel.core.Project project, org.apache.calcite.rel.core.TableScan newScan, List<org.apache.calcite.rex.RexNode> newProjects)
      Creates new DrillProjectRelBase instance with specified TableScan newScan child and List<RexNode> newProjects expressions using specified Project project as prototype.
      Parameters:
      project - the prototype of resulting project
      newScan - new project child
      newProjects - new project expressions
      Returns:
      new project instance
    • createScan

      protected org.apache.calcite.rel.core.TableScan createScan(org.apache.calcite.rel.core.TableScan scan, DrillRelOptUtil.ProjectPushInfo projectPushInfo)
      Creates new DrillScanRelBase instance with row type and fields list obtained from specified ProjectPushInfo projectPushInfo using specified TableScan scan as prototype.
      Parameters:
      scan - the prototype of resulting scan
      projectPushInfo - the source of row type and fields list
      Returns:
      new scan instance
    • canPushProjectIntoScan

      protected boolean canPushProjectIntoScan(org.apache.calcite.plan.RelOptTable table, DrillRelOptUtil.ProjectPushInfo projectPushInfo) throws IOException
      Push project into scan be done only if this is not a star query and table supports project push down.
      Parameters:
      table - table instance
      projectPushInfo - fields information
      Returns:
      true if push project into scan can be performed, false otherwise
      Throws:
      IOException