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
Modifier and TypeFieldDescriptionstatic 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
ConstructorDescriptionDrillPushProjectIntoScanRule
(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 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 newDrillProjectRelBase
instance with specifiedTableScan newScan
child andList<RexNode> newProjects
expressions using specifiedProject project
as prototype.protected org.apache.calcite.rel.core.TableScan
createScan
(org.apache.calcite.rel.core.TableScan scan, DrillRelOptUtil.ProjectPushInfo projectPushInfo) Creates newDrillScanRelBase
instance with row type and fields list obtained from specifiedProjectPushInfo projectPushInfo
using specifiedTableScan 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 inputTableScan
instance to targetTableScan
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
-
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:
onMatch
in 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 inputTableScan
instance to targetTableScan
may be omitted.- Parameters:
projectRelDataType
- project rel data typescan
- 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 newDrillProjectRelBase
instance with specifiedTableScan newScan
child andList<RexNode> newProjects
expressions using specifiedProject project
as 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 newDrillScanRelBase
instance with row type and fields list obtained from specifiedProjectPushInfo projectPushInfo
using specifiedTableScan scan
as 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
-