use of io.trino.sql.planner.plan.ExchangeNode.Type.REPLICATE in project trino by trinodb.
the class PlanFragmenter method analyzeGroupedExecution.
private SubPlan analyzeGroupedExecution(Session session, SubPlan subPlan) {
PlanFragment fragment = subPlan.getFragment();
GroupedExecutionProperties properties = fragment.getRoot().accept(new GroupedExecutionTagger(session, metadata, nodePartitioningManager), null);
if (properties.isSubTreeUseful()) {
boolean preferDynamic = fragment.getRemoteSourceNodes().stream().allMatch(node -> node.getExchangeType() == REPLICATE) && isDynamicScheduleForGroupedExecution(session);
BucketNodeMap bucketNodeMap = nodePartitioningManager.getBucketNodeMap(session, fragment.getPartitioning(), preferDynamic);
if (bucketNodeMap.isDynamic()) {
fragment = fragment.withDynamicLifespanScheduleGroupedExecution(properties.getCapableTableScanNodes());
} else {
fragment = fragment.withFixedLifespanScheduleGroupedExecution(properties.getCapableTableScanNodes());
}
}
ImmutableList.Builder<SubPlan> result = ImmutableList.builder();
for (SubPlan child : subPlan.getChildren()) {
result.add(analyzeGroupedExecution(session, child));
}
return new SubPlan(fragment, result.build());
}
Aggregations