@Override public Map<PlanNodeId, SplitSource> visitSort(SortNode node, Void context) { return node.getSource().accept(this, context); }
@Override public Map<Symbol, Symbol> visitSort(SortNode node, Set<Symbol> lookupSymbols) { return node.getSource().accept(this, lookupSymbols); }
@Override public Expression visitSort(SortNode node, Void context) { return node.getSource().accept(this, context); }
@Override public Void visitSort(SortNode node, Void context) { printNode(node, format("Sort[%s]", Joiner.on(", ").join(node.getOrderingScheme().getOrderBy())), NODE_COLORS.get(NodeType.SORT)); return node.getSource().accept(this, context); }
@Override public PlanNode visitSort(SortNode node, RewriteContext<Context> context) { // Sort has no bearing when building an index, so just ignore the sort return context.rewrite(node.getSource(), context.get()); }
@Override public Void visitSort(SortNode node, Set<Symbol> boundSymbols) { PlanNode source = node.getSource(); source.accept(this, boundSymbols); // visit child Set<Symbol> inputs = createInputs(source, boundSymbols); checkDependencies(inputs, node.getOutputSymbols(), "Invalid node. Output symbols (%s) not in source plan output (%s)", node.getOutputSymbols(), node.getSource().getOutputSymbols()); checkDependencies( inputs, node.getOrderingScheme().getOrderBy(), "Invalid node. Order by dependencies (%s) not in source plan output (%s)", node.getOrderingScheme().getOrderBy(), node.getSource().getOutputSymbols()); return null; }
@Override @Deprecated public PlanNode visitSort(SortNode node, RewriteContext<LimitContext> context) { LimitContext limit = context.get(); PlanNode rewrittenSource = context.rewrite(node.getSource()); if (limit != null) { return new TopNNode(node.getId(), rewrittenSource, limit.getCount(), node.getOrderingScheme(), TopNNode.Step.SINGLE); } else if (rewrittenSource != node.getSource()) { return new SortNode(node.getId(), rewrittenSource, node.getOrderingScheme()); } return node; }
@Override public PlanNode visitSort(SortNode node, RewriteContext<Set<Symbol>> context) { Set<Symbol> expectedInputs = ImmutableSet.copyOf(concat(context.get(), node.getOrderingScheme().getOrderBy())); PlanNode source = context.rewrite(node.getSource(), expectedInputs); return new SortNode(node.getId(), source, node.getOrderingScheme()); }
@Override public PlanNode visitSort(SortNode node, RewriteContext<Void> context) { PlanNode source = context.rewrite(node.getSource()); return new SortNode(node.getId(), source, canonicalizeAndDistinct(node.getOrderingScheme())); }
@Override public Result apply(LimitNode parent, Captures captures, Context context) { SortNode child = captures.get(CHILD); return Result.ofPlanNode( new TopNNode( parent.getId(), child.getSource(), parent.getCount(), child.getOrderingScheme(), parent.isPartial() ? TopNNode.Step.PARTIAL : TopNNode.Step.SINGLE)); } }
@Override public Optional<SplitSource> visitSort(SortNode node, Void context) { return node.getSource().accept(this, context); }
@Override public Map<Symbol, Symbol> visitSort(SortNode node, Set<Symbol> lookupSymbols) { return node.getSource().accept(this, lookupSymbols); }
@Override public Void visitSort(SortNode node, Void context) { node.getSource().accept(this, context); return null; }
@Override public Expression visitSort(SortNode node, Void context) { return node.getSource().accept(this, context); }
@Override public Void visitSort(SortNode node, Void context) { printNode(node, format("Sort[%s]", Joiner.on(", ").join(node.getOrderBy())), NODE_COLORS.get(NodeType.SORT)); return node.getSource().accept(this, context); }
@Override public PlanNode visitSort(SortNode node, RewriteContext<Context> context) { // Sort has no bearing when building an index, so just ignore the sort return context.rewrite(node.getSource(), context.get()); }
@Override public PlanNode visitSort(SortNode node, RewriteContext<Void> context) { PlanNode source = context.rewrite(node.getSource()); ImmutableList.Builder<Symbol> symbols = ImmutableList.builder(); ImmutableMap.Builder<Symbol, SortOrder> orderings = ImmutableMap.builder(); for (Symbol symbol : node.getOrderBy()) { Symbol canonical = canonicalize(symbol); symbols.add(canonical); orderings.put(canonical, node.getOrderings().get(symbol)); } return new SortNode(node.getId(), source, symbols.build(), orderings.build()); }
@Override public Void visitSort(SortNode node, Void context) { PlanNode source = node.getSource(); source.accept(this, context); // visit child verifyUniqueId(node); Set<Symbol> inputs = ImmutableSet.copyOf(source.getOutputSymbols()); checkDependencies(inputs, node.getOutputSymbols(), "Invalid node. Output symbols (%s) not in source plan output (%s)", node.getOutputSymbols(), node.getSource().getOutputSymbols()); checkDependencies(inputs, node.getOrderBy(), "Invalid node. Order by dependencies (%s) not in source plan output (%s)", node.getOrderBy(), node.getSource().getOutputSymbols()); return null; }
@Override public PlanNode visitSort(SortNode node, RewriteContext<Set<Symbol>> context) { Set<Symbol> expectedInputs = ImmutableSet.copyOf(concat(context.get(), node.getOrderBy())); PlanNode source = context.rewrite(node.getSource(), expectedInputs); return new SortNode(node.getId(), source, node.getOrderBy(), node.getOrderings()); }
@Override public PlanNode visitSort(SortNode node, RewriteContext<LimitContext> context) { LimitContext limit = context.get(); PlanNode rewrittenSource = context.rewrite(node.getSource()); if (limit != null) { return new TopNNode(node.getId(), rewrittenSource, limit.getCount(), node.getOrderBy(), node.getOrderings(), false); } else if (rewrittenSource != node.getSource()) { return new SortNode(node.getId(), rewrittenSource, node.getOrderBy(), node.getOrderings()); } return node; }