@Override public PlanNode replaceChildren(List<PlanNode> newChildren) { return new LimitNode(getId(), Iterables.getOnlyElement(newChildren), count, isPartial()); } }
@Override public PlanNode replaceChildren(List<PlanNode> newChildren) { return new LimitNode(getId(), Iterables.getOnlyElement(newChildren), count, isPartial()); } }
@Override public PlanNode visitLimit(LimitNode node, RewriteContext<Set<Symbol>> context) { ImmutableSet.Builder<Symbol> expectedInputs = ImmutableSet.<Symbol>builder() .addAll(context.get()); PlanNode source = context.rewrite(node.getSource(), expectedInputs.build()); return new LimitNode(node.getId(), source, node.getCount(), node.isPartial()); }
@Override public PlanNode visitLimit(LimitNode node, RewriteContext<Set<Symbol>> context) { ImmutableSet.Builder<Symbol> expectedInputs = ImmutableSet.<Symbol>builder() .addAll(context.get()); PlanNode source = context.rewrite(node.getSource(), expectedInputs.build()); return new LimitNode(node.getId(), source, node.getCount(), node.isPartial()); }
@Override public Result apply(LimitNode parent, Captures captures, Context context) { LimitNode child = captures.get(CHILD); return Result.ofPlanNode( new LimitNode( parent.getId(), child.getSource(), Math.min(parent.getCount(), child.getCount()), parent.isPartial())); } }
@Override public Result apply(LimitNode parent, Captures captures, Context context) { LimitNode child = captures.get(CHILD); return Result.ofPlanNode( new LimitNode( parent.getId(), child.getSource(), Math.min(parent.getCount(), child.getCount()), parent.isPartial())); } }
@Override public Result apply(LimitNode parent, Captures captures, Context context) { TopNNode child = captures.get(CHILD); return Result.ofPlanNode( new TopNNode( parent.getId(), child.getSource(), Math.min(parent.getCount(), child.getCount()), child.getOrderingScheme(), parent.isPartial() ? TopNNode.Step.PARTIAL : TopNNode.Step.SINGLE)); } }
@Override public Result apply(LimitNode parent, Captures captures, Context context) { TopNNode child = captures.get(CHILD); return Result.ofPlanNode( new TopNNode( parent.getId(), child.getSource(), Math.min(parent.getCount(), child.getCount()), child.getOrderingScheme(), parent.isPartial() ? TopNNode.Step.PARTIAL : TopNNode.Step.SINGLE)); } }
@Override public Void visitLimit(LimitNode node, Integer indent) { print(indent, "- Limit%s[%s] => [%s]", node.isPartial() ? "Partial" : "", node.getCount(), formatOutputs(node.getOutputSymbols())); printPlanNodesStatsAndCost(indent + 2, node); printStats(indent + 2, node.getId()); return processChildren(node, indent + 1); }
@Override public Void visitLimit(LimitNode node, Integer indent) { print(indent, "- Limit%s[%s] => [%s]", node.isPartial() ? "Partial" : "", node.getCount(), formatOutputs(node.getOutputSymbols())); printPlanNodesStatsAndCost(indent + 2, node); printStats(indent + 2, node.getId()); return processChildren(node, indent + 1); }
@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 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 PlanWithProperties visitLimit(LimitNode node, StreamPreferredProperties parentPreferences) { if (node.isPartial()) { return planAndEnforceChildren( node, parentPreferences.withoutPreference().withDefaultParallelism(session), parentPreferences.withDefaultParallelism(session)); } // final limit requires that all data be in one stream // also, a final changes the input organization completely, so we do not pass through parent preferences return planAndEnforceChildren( node, singleStream(), defaultParallelism(session)); }
@Override public PlanWithProperties visitLimit(LimitNode node, StreamPreferredProperties parentPreferences) { if (node.isPartial()) { return planAndEnforceChildren( node, parentPreferences.withoutPreference().withDefaultParallelism(session), parentPreferences.withDefaultParallelism(session)); } // final limit requires that all data be in one stream // also, a final changes the input organization completely, so we do not pass through parent preferences return planAndEnforceChildren( node, singleStream(), defaultParallelism(session)); }