QueryPlanner¶
QueryPlanner <
NOTE: QueryPlanner <
QueryPlanner's main method is <
QueryPlanner is part of Catalyst Framework.
=== [[contract]] QueryPlanner Contract
[source, scala]¶
abstract class QueryPlanner[PhysicalPlan <: TreeNode[PhysicalPlan]] { def collectPlaceholders(plan: PhysicalPlan): Seq[(PhysicalPlan, LogicalPlan)] def prunePlans(plans: Iterator[PhysicalPlan]): Iterator[PhysicalPlan] def strategies: Seq[GenericStrategy[PhysicalPlan]] }
.QueryPlanner Contract [cols="1,2",options="header",width="100%"] |=== | Method | Description
| [[strategies]] strategies | GenericStrategy planning strategies
Used exclusively as an extension point in <
| [[collectPlaceholders]] collectPlaceholders | Collection of "placeholder" physical plans and the corresponding spark-sql-LogicalPlan.md[logical plans].
Used exclusively as an extension point in <
Overriden in SparkPlanner
| [[prunePlans]] prunePlans | Prunes physical plans (e.g. bad or somehow incorrect plans).
Used exclusively as an extension point in <
=== [[plan]] Planning Logical Plan -- plan Method
[source, scala]¶
plan(plan: LogicalPlan): Iterator[PhysicalPlan]¶
plan converts the input plan spark-sql-LogicalPlan.md[logical plan] to zero or more PhysicalPlan plans.
Internally, plan applies <plan (one by one collecting all as the plan candidates).
plan then walks over the plan candidates to <
If a plan does not contain a placeholder, the plan is returned as is. Otherwise, plan walks over placeholders (as pairs of PhysicalPlan and unplanned spark-sql-LogicalPlan.md[logical plan]) and (recursively) <plan then replaces the placeholders with the planned child logical plan.
In the end, plan <
NOTE: plan is used exclusively (through the concrete SparkPlanner) when a QueryExecution is requested for a physical plan.