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
FieldsModifier and TypeFieldDescriptionstatic final org.apache.calcite.plan.RelOptRulestatic final org.apache.calcite.plan.RelOptRulestatic final org.apache.calcite.plan.RelOptRuleFields inherited from class org.apache.calcite.plan.RelOptRule
description, operands, relBuilderFactory -
Constructor Summary
ConstructorsConstructorDescriptionDrillPushProjectIntoScanRule(Class<? extends org.apache.calcite.rel.core.Project> projectClass, Class<? extends org.apache.calcite.rel.core.TableScan> scanClass, String description) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancanPushProjectIntoScan(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.ProjectcreateProject(org.apache.calcite.rel.core.Project project, org.apache.calcite.rel.core.TableScan newScan, List<org.apache.calcite.rex.RexNode> newProjects) Creates newDrillProjectRelBaseinstance with specifiedTableScan newScanchild andList<RexNode> newProjectsexpressions using specifiedProject projectas prototype.protected org.apache.calcite.rel.core.TableScancreateScan(org.apache.calcite.rel.core.TableScan scan, DrillRelOptUtil.ProjectPushInfo projectPushInfo) Creates newDrillScanRelBaseinstance with row type and fields list obtained from specifiedProjectPushInfo projectPushInfousing specifiedTableScan scanas prototype.voidonMatch(org.apache.calcite.plan.RelOptRuleCall call) protected booleanskipScanConversion(org.apache.calcite.rel.type.RelDataType projectRelDataType, org.apache.calcite.rel.core.TableScan scan) Checks whether conversion of inputTableScaninstance to targetTableScanmay 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
-
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
-
-
Method Details
-
onMatch
public void onMatch(org.apache.calcite.plan.RelOptRuleCall call) - Specified by:
onMatchin classorg.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 inputTableScaninstance to targetTableScanmay be omitted.- Parameters:
projectRelDataType- project rel data typescan- TableScan to be checked- Returns:
- true if specified
TableScanhas 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 newDrillProjectRelBaseinstance with specifiedTableScan newScanchild andList<RexNode> newProjectsexpressions using specifiedProject projectas prototype.- Parameters:
project- the prototype of resulting projectnewScan- new project childnewProjects- 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 newDrillScanRelBaseinstance with row type and fields list obtained from specifiedProjectPushInfo projectPushInfousing specifiedTableScan scanas prototype.- Parameters:
scan- the prototype of resulting scanprojectPushInfo- 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 instanceprojectPushInfo- fields information- Returns:
- true if push project into scan can be performed, false otherwise
- Throws:
IOException
-