Пример #1
0
 @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());
 }
    @Override
    public SubPlanBuilder visitLimit(LimitNode node, Void context) {
      SubPlanBuilder current = node.getSource().accept(this, context);

      current.setRoot(
          new LimitNode(node.getId(), current.getRoot(), node.getCount(), node.getSampleWeight()));

      if (current.isDistributed()) {
        current.setRoot(
            new SinkNode(
                idAllocator.getNextId(), current.getRoot(), current.getRoot().getOutputSymbols()));

        // create merge plan fragment
        PlanNode source =
            new ExchangeNode(
                idAllocator.getNextId(), current.getId(), current.getRoot().getOutputSymbols());
        LimitNode merge =
            new LimitNode(idAllocator.getNextId(), source, node.getCount(), node.getSampleWeight());
        current = createSingleNodePlan(merge).addChild(current.build());
      }

      return current;
    }
Пример #3
0
 @Override
 public Void visitLimit(LimitNode node, Void context) {
   printNode(node, format("Limit[%s]", node.getCount()), NODE_COLORS.get(NodeType.LIMIT));
   return node.getSource().accept(this, context);
 }
 @Override
 public Expression visitLimit(LimitNode node, Void context) {
   return node.getSource().accept(this, context);
 }