Minor refactor of AddExchanges.visitUnion()
The plannedChildren variable wasn't doing anything useful anymore so it
was just a layer of indirection.
@@ -1067,11 +1067,8 @@ public class AddExchanges
List<PlanNode> partitionedChildren = new ArrayList<>();
List<List<Symbol>> partitionedOutputLayouts = new ArrayList<>();
- List<PlanWithProperties> plannedChildren = new ArrayList<>();
-
for (int i = 0; i < node.getSources().size(); i++) {
PlanWithProperties child = node.getSources().get(i).accept(this, PreferredProperties.any());
- plannedChildren.add(child);
if (child.getProperties().isSingleNode()) {
unpartitionedChildren.add(child.getNode());
unpartitionedOutputLayouts.add(node.sourceOutputLayout(i));
@@ -1089,7 +1086,7 @@ public class AddExchanges
// children partitioning and don't GATHER partitioned inputs
// TODO: add FIXED_ARBITRARY_DISTRIBUTION support on non empty unpartitionedChildren
if (!parentGlobal.isPresent() || parentGlobal.get().isDistributed()) {
- return arbitraryDistributeUnion(node, plannedChildren, partitionedChildren, partitionedOutputLayouts);
+ return arbitraryDistributeUnion(node, partitionedChildren, partitionedOutputLayouts);
}
// add a gathering exchange above partitioned inputs
@@ -1147,7 +1144,6 @@ public class AddExchanges
private PlanWithProperties arbitraryDistributeUnion(
UnionNode node,
- List<PlanWithProperties> plannedChildren,
List<PlanNode> partitionedChildren,
List<List<Symbol>> partitionedOutputLayouts)
{
@@ -1156,10 +1152,7 @@ public class AddExchanges
// No source distributed child, we can use insert LOCAL exchange
// TODO: if all children have the same partitioning, pass this partitioning to the parent
// instead of "arbitraryPartition".
- return new PlanWithProperties(node.replaceChildren(
- plannedChildren.stream()
- .map(PlanWithProperties::getNode)
- .collect(toList())));
+ return new PlanWithProperties(node.replaceChildren(partitionedChildren));
}
else {
// Presto currently can not execute stage that has multiple table scans, so in that case
