WithCTEStrategy Execution Planning Strategy¶
WithCTEStrategy
is an execution planning strategy to plan WithCTE and CTERelationRef logical operators.
Executing Rule¶
apply(
plan: LogicalPlan): Seq[SparkPlan]
apply
plans WithCTE and CTERelationRef logical operators.
For a WithCTE
, apply
removes the WithCTE
layer by adding the CTERelationDefs to the (thread-local) collection of CTERelationDef
s (by their IDs) and marking the logical plan to plan later.
For a CTERelationRef
, apply
finds the logical plan for the cteId (in the (thread-local) collection of CTERelationDef
s) and creates a Project logical operator (over Alias
expressions).
In the end, apply
creates a ShuffleExchangeExec physical operator with the Project
(to plan later), RoundRobinPartitioning
output partitioning and REPARTITION_BY_COL
shuffle origin.
apply
is part of the GenericStrategy abstraction.