Class TopProjectVisitor
java.lang.Object
org.apache.drill.exec.planner.physical.visitor.BasePrelVisitor<Prel,Void,RuntimeException>
org.apache.drill.exec.planner.physical.visitor.TopProjectVisitor
- All Implemented Interfaces:
PrelVisitor<Prel,
Void, RuntimeException>
Adds non-trivial top project to ensure the final output field names are preserved.
Such non-trivial project is needed due to Calcite's behavior of ProjectRemoveRule.
It will be added under Screen/Writer operator in the physical plan
if there is no other Projects under these operators,
in cases like * column expansion or partition by column processing.
-
Field Summary
Fields inherited from interface org.apache.drill.exec.planner.physical.visitor.PrelVisitor
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Prel
insertTopProject
(Prel prel, org.apache.calcite.rel.type.RelDataType validatedRowType) Traverses passed physical relational node and its children and checks if top project should be added under screen or writer to preserve final output fields names.visitScreen
(ScreenPrel prel, Void value) visitWriter
(WriterPrel prel, Void value) Methods inherited from class org.apache.drill.exec.planner.physical.visitor.BasePrelVisitor
visitExchange, visitJoin, visitLateral, visitLeaf, visitProject, visitScan, visitScan, visitTableModify, visitUnnest
-
Constructor Details
-
TopProjectVisitor
public TopProjectVisitor(org.apache.calcite.rel.type.RelDataType validatedRowType)
-
-
Method Details
-
insertTopProject
public static Prel insertTopProject(Prel prel, org.apache.calcite.rel.type.RelDataType validatedRowType) Traverses passed physical relational node and its children and checks if top project should be added under screen or writer to preserve final output fields names.- Parameters:
prel
- physical relational nodevalidatedRowType
- final output row type- Returns:
- physical relational node with added project if necessary
-
visitPrel
- Specified by:
visitPrel
in interfacePrelVisitor<Prel,
Void, RuntimeException> - Overrides:
visitPrel
in classBasePrelVisitor<Prel,
Void, RuntimeException> - Throws:
RuntimeException
-
visitScreen
- Specified by:
visitScreen
in interfacePrelVisitor<Prel,
Void, RuntimeException> - Overrides:
visitScreen
in classBasePrelVisitor<Prel,
Void, RuntimeException>
-
visitWriter
- Specified by:
visitWriter
in interfacePrelVisitor<Prel,
Void, RuntimeException> - Overrides:
visitWriter
in classBasePrelVisitor<Prel,
Void, RuntimeException>
-