private PlanWithProperties arbitraryDistributeUnion( UnionNode node, List<PlanWithProperties> plannedChildren, List<PlanNode> partitionedChildren, List<List<Symbol>> partitionedOutputLayouts) { // TODO: can we insert LOCAL exchange for one child SOURCE distributed and another HASH distributed? if (countSources(partitionedChildren) == 0) { // 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()))); } else { // Presto currently can not execute stage that has multiple table scans, so in that case // we have to insert REMOTE exchange with FIXED_ARBITRARY_DISTRIBUTION instead of local exchange return new PlanWithProperties( new ExchangeNode( idAllocator.getNextId(), REPARTITION, REMOTE, new PartitioningScheme(Partitioning.create(FIXED_ARBITRARY_DISTRIBUTION, ImmutableList.of()), node.getOutputSymbols()), partitionedChildren, partitionedOutputLayouts, Optional.empty())); } }
private PlanWithProperties arbitraryDistributeUnion( UnionNode node, List<PlanWithProperties> plannedChildren, List<PlanNode> partitionedChildren, List<List<Symbol>> partitionedOutputLayouts) { // TODO: can we insert LOCAL exchange for one child SOURCE distributed and another HASH distributed? if (countSources(partitionedChildren) == 0) { // 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()))); } else { // Presto currently can not execute stage that has multiple table scans, so in that case // we have to insert REMOTE exchange with FIXED_ARBITRARY_DISTRIBUTION instead of local exchange return new PlanWithProperties( new ExchangeNode( idAllocator.getNextId(), REPARTITION, REMOTE, new PartitioningScheme(Partitioning.create(FIXED_ARBITRARY_DISTRIBUTION, ImmutableList.of()), node.getOutputSymbols()), partitionedChildren, partitionedOutputLayouts, Optional.empty())); } }