Package org.apache.calcite.rel
Interface PhysicalNode
- All Superinterfaces:
Cloneable
,RelNode
,RelOptNode
- All Known Subinterfaces:
EnumerableRel
- All Known Implementing Classes:
CassandraToEnumerableConverter
,CsvTableScan
,CsvTableScan
,ElasticsearchToEnumerableConverter
,EnumerableAggregate
,EnumerableAsofJoin
,EnumerableBatchNestedLoopJoin
,EnumerableCalc
,EnumerableCollect
,EnumerableCorrelate
,EnumerableFilter
,EnumerableHashJoin
,EnumerableInterpreter
,EnumerableIntersect
,EnumerableLimit
,EnumerableLimitSort
,EnumerableMatch
,EnumerableMergeJoin
,EnumerableMergeUnion
,EnumerableMinus
,EnumerableNestedLoopJoin
,EnumerableProject
,EnumerableRepeatUnion
,EnumerableSort
,EnumerableSortedAggregate
,EnumerableTableFunctionScan
,EnumerableTableModify
,EnumerableTableScan
,EnumerableTableSpool
,EnumerableUncollect
,EnumerableUnion
,EnumerableValues
,EnumerableWindow
,GeodeToEnumerableConverter
,InnodbToEnumerableConverter
,JdbcToEnumerableConverter
,MongoToEnumerableConverter
,PigToEnumerableConverter
,SparkToEnumerableConverter
,SplunkTableScan
Physical node in a planner that is capable of doing
physical trait propagation and derivation.
How to use?
- Enable top-down optimization by setting
VolcanoPlanner.setTopDownOpt(boolean)
. - Let your convention's rel interface extends
PhysicalNode
, seeEnumerableRel
as an example. - Each physical operator overrides any one of the two methods:
passThrough(RelTraitSet)
orpassThroughTraits(RelTraitSet)
depending on your needs. - Choose derive mode for each physical operator by overriding
getDeriveMode()
. - If the derive mode is
DeriveMode.OMAKASE
, override methodderive(List)
in the physical operator, otherwise, overridederive(RelTraitSet, int)
orderiveTraits(RelTraitSet, int)
. - Mark your enforcer operator by overriding
RelNode.isEnforcer()
, seeSort.isEnforcer()
as an example. This is important, because it can helpVolcanoPlanner
avoid unnecessary trait propagation and derivation, therefore improve optimization efficiency. - Implement
Convention.enforce(RelNode, RelTraitSet)
in your convention, which generates appropriate physical enforcer. SeeEnumerableConvention
as example. Simply returnnull
if you don't want physical trait enforcement.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.calcite.rel.RelNode
RelNode.Context
-
Method Summary
Modifier and TypeMethodDescriptionderive
(List<List<RelTraitSet>> inputTraits) Given a list of child traitsets, inputTraits.size() == getInput().size(), returns node list after traits derivation.default @Nullable RelNode
derive
(RelTraitSet childTraits, int childId) Derive traitset from child node, returns new node after traits derivation.default @Nullable Pair<RelTraitSet,
List<RelTraitSet>> deriveTraits
(RelTraitSet childTraits, int childId) Derive traitset from child node, returns a pair of traits after traits derivation.default DeriveMode
Returns mode of derivation.default @Nullable RelNode
passThrough
(RelTraitSet required) Pass required traitset from parent node to child nodes, returns new node after traits is passed down.default @Nullable Pair<RelTraitSet,
List<RelTraitSet>> passThroughTraits
(RelTraitSet required) Pass required traitset from parent node to child nodes, returns a pair of traits after traits is passed down.Methods inherited from interface org.apache.calcite.rel.RelNode
accept, accept, childrenAccept, collectVariablesSet, collectVariablesUsed, computeSelfCost, copy, deepEquals, deepHashCode, estimateRowCount, explain, explain, fieldIsNullable, getConvention, getCorrelVariable, getDigest, getExpectedInputRowType, getInput, getInputs, getRelDigest, getRelTypeName, getRowType, getTable, getVariablesSet, isEnforcer, isValid, metadata, onRegister, recomputeDigest, register, replaceInput, stripped
Methods inherited from interface org.apache.calcite.plan.RelOptNode
getCluster, getDescription, getId, getTraitSet
-
Method Details
-
passThrough
Pass required traitset from parent node to child nodes, returns new node after traits is passed down. -
passThroughTraits
Pass required traitset from parent node to child nodes, returns a pair of traits after traits is passed down.Pair.left: the new traitset; Pair.right: the list of required traitsets for child nodes.
-
derive
Derive traitset from child node, returns new node after traits derivation. -
deriveTraits
default @Nullable Pair<RelTraitSet,List<RelTraitSet>> deriveTraits(RelTraitSet childTraits, int childId) Derive traitset from child node, returns a pair of traits after traits derivation.Pair.left: the new traitset; Pair.right: the list of required traitsets for child nodes.
-
derive
Given a list of child traitsets, inputTraits.size() == getInput().size(), returns node list after traits derivation. This method is called ONLY when the derive mode is OMAKASE. -
getDeriveMode
Returns mode of derivation.
-