@Override public Map<PlanNodeId, SplitSource> visitSemiJoin(SemiJoinNode node, Void context) { Map<PlanNodeId, SplitSource> sourceSplits = node.getSource().accept(this, context); Map<PlanNodeId, SplitSource> filteringSourceSplits = node.getFilteringSource().accept(this, context); return ImmutableMap.<PlanNodeId, SplitSource>builder() .putAll(sourceSplits) .putAll(filteringSourceSplits) .build(); }
@Override public Result apply(SemiJoinNode semiJoinNode, Captures captures, Context context) { Set<Symbol> requiredFilteringSourceInputs = Streams.concat( Stream.of(semiJoinNode.getFilteringSourceJoinSymbol()), semiJoinNode.getFilteringSourceHashSymbol().map(Stream::of).orElse(Stream.empty())) .collect(toImmutableSet()); return restrictOutputs(context.getIdAllocator(), semiJoinNode.getFilteringSource(), requiredFilteringSourceInputs) .map(newFilteringSource -> semiJoinNode.replaceChildren(ImmutableList.of(semiJoinNode.getSource(), newFilteringSource))) .map(Result::ofPlanNode) .orElse(Result.empty()); } }
@Override public Void visitSemiJoin(SemiJoinNode node, Void context) { printNode(node, "SemiJoin", format("%s = %s", node.getSourceJoinSymbol(), node.getFilteringSourceJoinSymbol()), NODE_COLORS.get(NodeType.JOIN)); node.getSource().accept(this, context); node.getFilteringSource().accept(this, context); return null; }
@Override public Result apply(SemiJoinNode semiJoinNode, Captures captures, Context context) { Set<Symbol> requiredFilteringSourceInputs = Streams.concat( Stream.of(semiJoinNode.getFilteringSourceJoinSymbol()), semiJoinNode.getFilteringSourceHashSymbol().map(Stream::of).orElse(Stream.empty())) .collect(toImmutableSet()); return restrictOutputs(context.getIdAllocator(), semiJoinNode.getFilteringSource(), requiredFilteringSourceInputs) .map(newFilteringSource -> semiJoinNode.replaceChildren(ImmutableList.of(semiJoinNode.getSource(), newFilteringSource))) .map(Result::ofPlanNode) .orElse(Result.empty()); } }
@Override public Void visitSemiJoin(SemiJoinNode node, Void context) { printNode(node, "SemiJoin", format("%s = %s", node.getSourceJoinSymbol(), node.getFilteringSourceJoinSymbol()), NODE_COLORS.get(NodeType.JOIN)); node.getSource().accept(this, context); node.getFilteringSource().accept(this, context); return null; }
@Override public Map<PlanNodeId, SplitSource> visitSemiJoin(SemiJoinNode node, Void context) { Map<PlanNodeId, SplitSource> sourceSplits = node.getSource().accept(this, context); Map<PlanNodeId, SplitSource> filteringSourceSplits = node.getFilteringSource().accept(this, context); return ImmutableMap.<PlanNodeId, SplitSource>builder() .putAll(sourceSplits) .putAll(filteringSourceSplits) .build(); }
@Override public PlanNode visitSemiJoin(SemiJoinNode node, RewriteContext<Void> context) { PlanNode source = context.rewrite(node.getSource()); PlanNode filteringSource = context.rewrite(node.getFilteringSource()); return new SemiJoinNode( node.getId(), source, filteringSource, canonicalize(node.getSourceJoinSymbol()), canonicalize(node.getFilteringSourceJoinSymbol()), canonicalize(node.getSemiJoinOutput()), canonicalize(node.getSourceHashSymbol()), canonicalize(node.getFilteringSourceHashSymbol()), node.getDistributionType()); }
@Override public Void visitSemiJoin(SemiJoinNode node, Set<Symbol> boundSymbols) { node.getSource().accept(this, boundSymbols); node.getFilteringSource().accept(this, boundSymbols); checkArgument(node.getSource().getOutputSymbols().contains(node.getSourceJoinSymbol()), "Symbol from semi join clause (%s) not in source (%s)", node.getSourceJoinSymbol(), node.getSource().getOutputSymbols()); checkArgument(node.getFilteringSource().getOutputSymbols().contains(node.getFilteringSourceJoinSymbol()), "Symbol from semi join clause (%s) not in filtering source (%s)", node.getSourceJoinSymbol(), node.getFilteringSource().getOutputSymbols()); Set<Symbol> outputs = createInputs(node, boundSymbols); checkArgument(outputs.containsAll(node.getSource().getOutputSymbols()), "Semi join output symbols (%s) must contain all of the source symbols (%s)", node.getOutputSymbols(), node.getSource().getOutputSymbols()); checkArgument(outputs.contains(node.getSemiJoinOutput()), "Semi join output symbols (%s) must contain join result (%s)", node.getOutputSymbols(), node.getSemiJoinOutput()); return null; }
@Override public Set<PlanFragmentId> visitSemiJoin(SemiJoinNode node, PlanFragmentId currentFragmentId) { return processJoin(node.getFilteringSource(), node.getSource(), currentFragmentId); }
@Override public Set<PlanFragmentId> visitSemiJoin(SemiJoinNode node, PlanFragmentId currentFragmentId) { return processJoin(node.getFilteringSource(), node.getSource(), currentFragmentId); }
@Override public PlanNodeCostEstimate visitSemiJoin(SemiJoinNode node, Void context) { return calculateJoinExchangeCost( node.getSource(), node.getFilteringSource(), stats, types, Objects.equals(node.getDistributionType(), Optional.of(SemiJoinNode.DistributionType.REPLICATED)), taskCountEstimator.estimateSourceDistributedTaskCount()); }
@Override public PlanNodeCostEstimate visitSemiJoin(SemiJoinNode node, Void context) { return calculateJoinExchangeCost( node.getSource(), node.getFilteringSource(), stats, types, Objects.equals(node.getDistributionType(), Optional.of(SemiJoinNode.DistributionType.REPLICATED)), taskCountEstimator.estimateSourceDistributedTaskCount()); }
@Override public Void visitSemiJoin(SemiJoinNode node, Consumer<PlanNodeId> schedulingOrder) { node.getFilteringSource().accept(this, schedulingOrder); node.getSource().accept(this, schedulingOrder); return null; }
@Override public PlanNodeCostEstimate visitSemiJoin(SemiJoinNode node, Void context) { return calculateJoinCost( node, node.getSource(), node.getFilteringSource(), node.getDistributionType().orElse(SemiJoinNode.DistributionType.PARTITIONED).equals(SemiJoinNode.DistributionType.REPLICATED)); }
@Override public Void visitSemiJoin(SemiJoinNode node, Void context) { node.getFilteringSource().accept(this, context); node.getSource().accept(this, context); return null; }
@Override public PlanNodeCostEstimate visitSemiJoin(SemiJoinNode node, Void context) { return calculateJoinCost( node, node.getSource(), node.getFilteringSource(), node.getDistributionType().orElse(SemiJoinNode.DistributionType.PARTITIONED).equals(SemiJoinNode.DistributionType.REPLICATED)); }
@Override public Void visitSemiJoin(SemiJoinNode node, Void context) { node.getFilteringSource().accept(this, context); node.getSource().accept(this, context); return null; }
@Override public Void visitSemiJoin(SemiJoinNode node, Consumer<PlanNodeId> schedulingOrder) { node.getFilteringSource().accept(this, schedulingOrder); node.getSource().accept(this, schedulingOrder); return null; }
@Override public PlanWithProperties visitSemiJoin(SemiJoinNode node, StreamPreferredProperties parentPreferences) { PlanWithProperties source = planAndEnforce( node.getSource(), defaultParallelism(session), parentPreferences.constrainTo(node.getSource().getOutputSymbols()).withDefaultParallelism(session)); // this filter source consumes the input completely, so we do not pass through parent preferences PlanWithProperties filteringSource = planAndEnforce(node.getFilteringSource(), singleStream(), singleStream()); return rebaseAndDeriveProperties(node, ImmutableList.of(source, filteringSource)); }
@Override public PlanWithProperties visitSemiJoin(SemiJoinNode node, StreamPreferredProperties parentPreferences) { PlanWithProperties source = planAndEnforce( node.getSource(), defaultParallelism(session), parentPreferences.constrainTo(node.getSource().getOutputSymbols()).withDefaultParallelism(session)); // this filter source consumes the input completely, so we do not pass through parent preferences PlanWithProperties filteringSource = planAndEnforce(node.getFilteringSource(), singleStream(), singleStream()); return rebaseAndDeriveProperties(node, ImmutableList.of(source, filteringSource)); }