Refine search
@Override public Void visitUnnest(UnnestNode node, Set<Symbol> boundSymbols) { PlanNode source = node.getSource(); source.accept(this, boundSymbols); Set<Symbol> required = ImmutableSet.<Symbol>builder() .addAll(node.getReplicateSymbols()) .addAll(node.getUnnestSymbols().keySet()) .build(); checkDependencies(source.getOutputSymbols(), required, "Invalid node. Dependencies (%s) not in source plan output (%s)", required, source.getOutputSymbols()); return null; }
@Override public Void visitGroupId(GroupIdNode node, Void context) { // grouping sets are easier to understand in terms of inputs List<String> inputGroupingSetSymbols = node.getGroupingSets().stream() .map(set -> "(" + Joiner.on(", ").join(set.stream() .map(symbol -> node.getGroupingColumns().get(symbol)) .collect(Collectors.toList())) + ")") .collect(Collectors.toList()); printNode(node, "GroupId", Joiner.on(", ").join(inputGroupingSetSymbols), NODE_COLORS.get(NodeType.AGGREGATE)); return node.getSource().accept(this, context); }
@Override public Map<Symbol, Symbol> visitIndexJoin(IndexJoinNode node, Set<Symbol> lookupSymbols) { Set<Symbol> probeLookupSymbols = lookupSymbols.stream() .filter(node.getProbeSource().getOutputSymbols()::contains) .collect(toImmutableSet()); checkState(!probeLookupSymbols.isEmpty(), "No lookup symbols were able to pass through the index join probe source"); return node.getProbeSource().accept(this, probeLookupSymbols); }
private Void visitSetOperation(SetOperationNode node, Set<Symbol> boundSymbols) { for (int i = 0; i < node.getSources().size(); i++) { PlanNode subplan = node.getSources().get(i); checkDependencies(subplan.getOutputSymbols(), node.sourceOutputLayout(i), "%s subplan must provide all of the necessary symbols", node.getClass().getSimpleName()); subplan.accept(this, boundSymbols); // visit child } return null; }
@Override public Void visitLateralJoin(LateralJoinNode node, Void context) { String parameters = Joiner.on(",").join(node.getCorrelation()); printNode(node, "LateralJoin", parameters, NODE_COLORS.get(NodeType.JOIN)); node.getInput().accept(this, context); node.getSubquery().accept(this, context); return null; }
private PlanWithProperties plan(PlanNode node, HashComputationSet parentPreference) { PlanWithProperties result = node.accept(this, parentPreference); checkState( result.getNode().getOutputSymbols().containsAll(result.getHashSymbols().values()), "Node %s declares hash symbols not in the output", result.getNode().getClass().getSimpleName()); return result; } }
@Override public Void visitDelete(DeleteNode node, Set<Symbol> boundSymbols) { PlanNode source = node.getSource(); source.accept(this, boundSymbols); // visit child checkArgument(source.getOutputSymbols().contains(node.getRowId()), "Invalid node. Row ID symbol (%s) is not in source plan output (%s)", node.getRowId(), node.getSource().getOutputSymbols()); return null; }
private PlanWithProperties planAndEnforce(PlanNode node, StreamPreferredProperties requiredProperties, StreamPreferredProperties preferredProperties) { // verify properties are in terms of symbols produced by the node List<Symbol> outputSymbols = node.getOutputSymbols(); checkArgument(requiredProperties.getPartitioningColumns().map(outputSymbols::containsAll).orElse(true)); checkArgument(preferredProperties.getPartitioningColumns().map(outputSymbols::containsAll).orElse(true)); // plan the node using the preferred properties PlanWithProperties result = node.accept(this, preferredProperties); // enforce the required properties result = enforce(result, requiredProperties); checkState(requiredProperties.isSatisfiedBy(result.getProperties()), "required properties not enforced"); return result; }
@Override public Void visitMarkDistinct(MarkDistinctNode node, Set<Symbol> boundSymbols) { PlanNode source = node.getSource(); source.accept(this, boundSymbols); // visit child checkDependencies(source.getOutputSymbols(), node.getDistinctSymbols(), "Invalid node. Mark distinct symbols (%s) not in source plan output (%s)", node.getDistinctSymbols(), source.getOutputSymbols()); return null; }
@Override public Void visitOutput(OutputNode node, Set<Symbol> boundSymbols) { PlanNode source = node.getSource(); source.accept(this, boundSymbols); // visit child checkDependencies(source.getOutputSymbols(), node.getOutputSymbols(), "Invalid node. Output column dependencies (%s) not in source plan output (%s)", node.getOutputSymbols(), source.getOutputSymbols()); return null; }
@Override public Void visitDistinctLimit(DistinctLimitNode node, Set<Symbol> boundSymbols) { PlanNode source = node.getSource(); source.accept(this, boundSymbols); // visit child checkDependencies(source.getOutputSymbols(), node.getOutputSymbols(), "Invalid node. Output column dependencies (%s) not in source plan output (%s)", node.getOutputSymbols(), source.getOutputSymbols()); return null; }
@Override public Void visitWindow(WindowNode node, Void context) { printNode(node, "Window", format("partition by = %s|order by = %s", Joiner.on(", ").join(node.getPartitionBy()), node.getOrderingScheme() .map(orderingScheme -> Joiner.on(", ").join(orderingScheme.getOrderBy())) .orElse("")), NODE_COLORS.get(NodeType.WINDOW)); return node.getSource().accept(this, context); }
@Override public Void visitGroupId(GroupIdNode node, Set<Symbol> boundSymbols) { PlanNode source = node.getSource(); source.accept(this, boundSymbols); // visit child checkDependencies(source.getOutputSymbols(), node.getInputSymbols(), "Invalid node. Grouping symbols (%s) not in source plan output (%s)", node.getInputSymbols(), source.getOutputSymbols()); return null; }