Class AdaptivePlanner
Re-planning Steps: 1. It first merges all SubPlans into a single PlanNode where RemoteSourceNode for stages that haven’t finished will get replaced with Remote Exchanges. On the other hand, RemoteSourceNode for finished stages will remain as it is in the plan.
2. Once we have a merged plan which contains all the unfinished parts, we will reoptimize it using a set of PlanOptimizers.
3. During re-optimization, it is possible that some new exchanges need to be added due to the change in partitioning strategy. For instance, if a rule changes the distribution type of the join from BROADCAST to PARTITIONED. It is also possible that some remote exchanges are removed. For example, while changing the order of the join.
4. Ultimately, the planner will fragment the optimized PlanNode again and generate the SubPlans with new PlanFragmentIds. The re-fragmentation will only happen if the old plan and the new plan have some differences. To check these differences, we rely on PlanOptimizer#optimizeAndMarkPlanChanges api which also returns changed plan ids.
Note: We do not change the fragment ids which have no changes and are not downstream of the changed plan nodes. This optimization is done to avoid unnecessary stage restart due to speculative execution.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionAdaptivePlanner(Session session, PlannerContext plannerContext, List<AdaptivePlanOptimizer> planOptimizers, PlanFragmenter planFragmenter, PlanSanityChecker planSanityChecker, WarningCollector warningCollector, PlanOptimizersStatsCollector planOptimizersStatsCollector, CachingTableStatsProvider tableStatsProvider) -
Method Summary
Modifier and TypeMethodDescriptionoptimize(SubPlan root, RuntimeInfoProvider runtimeInfoProvider)
-
Constructor Details
-
AdaptivePlanner
public AdaptivePlanner(Session session, PlannerContext plannerContext, List<AdaptivePlanOptimizer> planOptimizers, PlanFragmenter planFragmenter, PlanSanityChecker planSanityChecker, WarningCollector warningCollector, PlanOptimizersStatsCollector planOptimizersStatsCollector, CachingTableStatsProvider tableStatsProvider)
-
-
Method Details
-
optimize
-