public StreamPreferredProperties constrainTo(Iterable<Symbol> symbols) { if (!partitioningColumns.isPresent()) { return this; } ImmutableSet<Symbol> availableSymbols = ImmutableSet.copyOf(symbols); if (exactColumnOrder) { if (availableSymbols.containsAll(partitioningColumns.get())) { return this; } return any(); } List<Symbol> common = partitioningColumns.get().stream() .filter(availableSymbols::contains) .collect(toImmutableList()); if (common.isEmpty()) { return any(); } return new StreamPreferredProperties(distribution, Optional.of(common), false); } }
public static StreamPreferredProperties defaultParallelism(Session session) { if (getTaskConcurrency(session) > 1 && !preferStreamingOperators(session)) { return new StreamPreferredProperties(Optional.of(MULTIPLE), Optional.empty(), false); } return any(); }
@Override public PlanWithProperties visitExchange(ExchangeNode node, StreamPreferredProperties parentPreferences) { checkArgument(node.getScope() != LOCAL, "AddLocalExchanges can not process a plan containing a local exchange"); // this node changes the input organization completely, so we do not pass through parent preferences if (node.getOrderingScheme().isPresent()) { return planAndEnforceChildren( node, any().withOrderSensitivity(), any().withOrderSensitivity()); } return planAndEnforceChildren(node, any(), defaultParallelism(session)); }
@Override public PlanNode optimize(PlanNode plan, Session session, TypeProvider types, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator, WarningCollector warningCollector) { PlanWithProperties result = plan.accept(new Rewriter(symbolAllocator, idAllocator, session), any()); return result.getNode(); }
PlanWithProperties child = planAndEnforce(node.getSource(), any(), defaultParallelism(session)); PlanWithProperties exchange = deriveProperties( partitionedExchange(