@Override public Map<PlanNodeId, SplitSource> visitJoin(JoinNode node, Void context) { Map<PlanNodeId, SplitSource> leftSplits = node.getLeft().accept(this, context); Map<PlanNodeId, SplitSource> rightSplits = node.getRight().accept(this, context); return ImmutableMap.<PlanNodeId, SplitSource>builder() .putAll(leftSplits) .putAll(rightSplits) .build(); }
@Override public Map<PlanNodeId, SplitSource> visitJoin(JoinNode node, Void context) { Map<PlanNodeId, SplitSource> leftSplits = node.getLeft().accept(this, context); Map<PlanNodeId, SplitSource> rightSplits = node.getRight().accept(this, context); return ImmutableMap.<PlanNodeId, SplitSource>builder() .putAll(leftSplits) .putAll(rightSplits) .build(); }
@Override public Set<PlanFragmentId> visitJoin(JoinNode node, PlanFragmentId currentFragmentId) { return processJoin(node.getRight(), node.getLeft(), currentFragmentId); }
@Override public PlanNodeCostEstimate visitJoin(JoinNode node, Void context) { return calculateJoinCost( node, node.getLeft(), node.getRight(), Objects.equals(node.getDistributionType(), Optional.of(JoinNode.DistributionType.REPLICATED))); }
@Override public Set<PlanFragmentId> visitJoin(JoinNode node, PlanFragmentId currentFragmentId) { return processJoin(node.getRight(), node.getLeft(), currentFragmentId); }
private PlanNode pushPartialToRightChild(AggregationNode node, JoinNode child, Context context) { Set<Symbol> joinRightChildSymbols = ImmutableSet.copyOf(child.getRight().getOutputSymbols()); List<Symbol> groupingSet = getPushedDownGroupingSet(node, joinRightChildSymbols, intersection(getJoinRequiredSymbols(child), joinRightChildSymbols)); AggregationNode pushedAggregation = replaceAggregationSource(node, child.getRight(), groupingSet); return pushPartialToJoin(node, child, child.getLeft(), pushedAggregation, context); }
@Override public PlanNodeCostEstimate visitJoin(JoinNode node, Void context) { return calculateJoinExchangeCost( node.getLeft(), node.getRight(), stats, types, Objects.equals(node.getDistributionType(), Optional.of(JoinNode.DistributionType.REPLICATED)), taskCountEstimator.estimateSourceDistributedTaskCount()); }
private static boolean mustReplicate(JoinNode joinNode, Context context) { JoinNode.Type type = joinNode.getType(); if (joinNode.getCriteria().isEmpty() && (type == INNER || type == LEFT)) { // There is nothing to partition on return true; } return isAtMostScalar(joinNode.getRight(), context.getLookup()); }
@Override public Void visitJoin(JoinNode node, Consumer<PlanNodeId> schedulingOrder) { node.getRight().accept(this, schedulingOrder); node.getLeft().accept(this, schedulingOrder); return null; }
@Override public Void visitJoin(JoinNode node, Void context) { node.getRight().accept(this, context); node.getLeft().accept(this, context); return null; }
@Override public Void visitJoin(JoinNode node, Consumer<PlanNodeId> schedulingOrder) { node.getRight().accept(this, schedulingOrder); node.getLeft().accept(this, schedulingOrder); return null; }
private static boolean mustReplicate(JoinNode joinNode, Context context) { JoinNode.Type type = joinNode.getType(); if (joinNode.getCriteria().isEmpty() && (type == INNER || type == LEFT)) { // There is nothing to partition on return true; } return isAtMostScalar(joinNode.getRight(), context.getLookup()); }
private static PlanNode getInnerTable(JoinNode join) { checkState(join.getType() == JoinNode.Type.LEFT || join.getType() == JoinNode.Type.RIGHT, "expected LEFT or RIGHT JOIN"); PlanNode innerNode; if (join.getType().equals(JoinNode.Type.LEFT)) { innerNode = join.getRight(); } else { innerNode = join.getLeft(); } return innerNode; }
private static PlanNode getOuterTable(JoinNode join) { checkState(join.getType() == JoinNode.Type.LEFT || join.getType() == JoinNode.Type.RIGHT, "expected LEFT or RIGHT JOIN"); PlanNode outerNode; if (join.getType().equals(JoinNode.Type.LEFT)) { outerNode = join.getLeft(); } else { outerNode = join.getRight(); } return outerNode; }
private static PlanNode getInnerTable(JoinNode join) { checkState(join.getType() == JoinNode.Type.LEFT || join.getType() == JoinNode.Type.RIGHT, "expected LEFT or RIGHT JOIN"); PlanNode innerNode; if (join.getType().equals(JoinNode.Type.LEFT)) { innerNode = join.getRight(); } else { innerNode = join.getLeft(); } return innerNode; }
private static PlanNode getOuterTable(JoinNode join) { checkState(join.getType() == JoinNode.Type.LEFT || join.getType() == JoinNode.Type.RIGHT, "expected LEFT or RIGHT JOIN"); PlanNode outerNode; if (join.getType().equals(JoinNode.Type.LEFT)) { outerNode = join.getLeft(); } else { outerNode = join.getRight(); } return outerNode; }
private PlanNode pushPartialToLeftChild(AggregationNode node, JoinNode child, Context context) { Set<Symbol> joinLeftChildSymbols = ImmutableSet.copyOf(child.getLeft().getOutputSymbols()); List<Symbol> groupingSet = getPushedDownGroupingSet(node, joinLeftChildSymbols, intersection(getJoinRequiredSymbols(child), joinLeftChildSymbols)); AggregationNode pushedAggregation = replaceAggregationSource(node, child.getLeft(), groupingSet); return pushPartialToJoin(node, child, pushedAggregation, child.getRight(), context); }
private PlanNode pushPartialToLeftChild(AggregationNode node, JoinNode child, Context context) { Set<Symbol> joinLeftChildSymbols = ImmutableSet.copyOf(child.getLeft().getOutputSymbols()); List<Symbol> groupingSet = getPushedDownGroupingSet(node, joinLeftChildSymbols, intersection(getJoinRequiredSymbols(child), joinLeftChildSymbols)); AggregationNode pushedAggregation = replaceAggregationSource(node, child.getLeft(), groupingSet); return pushPartialToJoin(node, child, pushedAggregation, child.getRight(), context); }
private PlanNodeStatsEstimate crossJoinStats(JoinNode node, PlanNodeStatsEstimate leftStats, PlanNodeStatsEstimate rightStats, TypeProvider types) { PlanNodeStatsEstimate.Builder builder = PlanNodeStatsEstimate.builder() .setOutputRowCount(leftStats.getOutputRowCount() * rightStats.getOutputRowCount()); node.getLeft().getOutputSymbols().forEach(symbol -> builder.addSymbolStatistics(symbol, leftStats.getSymbolStatistics(symbol))); node.getRight().getOutputSymbols().forEach(symbol -> builder.addSymbolStatistics(symbol, rightStats.getSymbolStatistics(symbol))); return normalizer.normalize(builder.build(), types); }
private PlanNodeStatsEstimate crossJoinStats(JoinNode node, PlanNodeStatsEstimate leftStats, PlanNodeStatsEstimate rightStats, TypeProvider types) { PlanNodeStatsEstimate.Builder builder = PlanNodeStatsEstimate.builder() .setOutputRowCount(leftStats.getOutputRowCount() * rightStats.getOutputRowCount()); node.getLeft().getOutputSymbols().forEach(symbol -> builder.addSymbolStatistics(symbol, leftStats.getSymbolStatistics(symbol))); node.getRight().getOutputSymbols().forEach(symbol -> builder.addSymbolStatistics(symbol, rightStats.getSymbolStatistics(symbol))); return normalizer.normalize(builder.build(), types); }