Fix grouped execution property for merge join
visitMergeJoin function was missing from GroupedExecutionTagger which makes it
impossible to obtain the grouped execution property for MergeJoinNode
@@ -59,6 +59,7 @@ import com.facebook.presto.sql.planner.plan.ExchangeNode;
import com.facebook.presto.sql.planner.plan.ExplainAnalyzeNode;
import com.facebook.presto.sql.planner.plan.InternalPlanVisitor;
import com.facebook.presto.sql.planner.plan.JoinNode;
+import com.facebook.presto.sql.planner.plan.MergeJoinNode;
import com.facebook.presto.sql.planner.plan.MetadataDeleteNode;
import com.facebook.presto.sql.planner.plan.OutputNode;
import com.facebook.presto.sql.planner.plan.PlanFragmentId;
@@ -1082,6 +1083,27 @@ public class PlanFragmenter
}
}
+ @Override
+ public GroupedExecutionProperties visitMergeJoin(MergeJoinNode node, Void context)
+ {
+ GroupedExecutionProperties left = node.getLeft().accept(this, null);
+ GroupedExecutionProperties right = node.getRight().accept(this, null);
+
+ if (groupedExecutionEnabled && left.currentNodeCapable && right.currentNodeCapable) {
+ checkState(left.totalLifespans == right.totalLifespans, format("Mismatched number of lifespans on left(%s) and right(%s) side of join", left.totalLifespans, right.totalLifespans));
+ return new GroupedExecutionProperties(
+ true,
+ true,
+ ImmutableList.<PlanNodeId>builder()
+ .addAll(left.capableTableScanNodes)
+ .addAll(right.capableTableScanNodes)
+ .build(),
+ left.totalLifespans,
+ left.recoveryEligible && right.recoveryEligible);
+ }
+ return GroupedExecutionProperties.notCapable();
+ }
+
@Override
public GroupedExecutionProperties visitAggregation(AggregationNode node, Void context)
{
