コード例 #1
0
    @Override
    public SubPlanBuilder visitDistinctLimit(DistinctLimitNode node, Void context) {
      SubPlanBuilder current = node.getSource().accept(this, context);

      current.setRoot(new DistinctLimitNode(node.getId(), current.getRoot(), node.getLimit()));

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

        PlanNode source =
            new ExchangeNode(
                idAllocator.getNextId(), current.getId(), current.getRoot().getOutputSymbols());
        DistinctLimitNode merge =
            new DistinctLimitNode(idAllocator.getNextId(), source, node.getLimit());
        current = createSingleNodePlan(merge).addChild(current.build());
      }
      return current;
    }
コード例 #2
0
 @Override
 public PlanNode visitDistinctLimit(
     DistinctLimitNode node, RewriteContext<Set<Symbol>> context) {
   Set<Symbol> expectedInputs;
   if (node.getHashSymbol().isPresent()) {
     expectedInputs =
         ImmutableSet.copyOf(
             concat(node.getOutputSymbols(), ImmutableList.of(node.getHashSymbol().get())));
   } else {
     expectedInputs = ImmutableSet.copyOf(node.getOutputSymbols());
   }
   PlanNode source = context.rewrite(node.getSource(), expectedInputs);
   return new DistinctLimitNode(node.getId(), source, node.getLimit(), node.getHashSymbol());
 }
コード例 #3
0
 @Override
 public Void visitDistinctLimit(final DistinctLimitNode node, Void context) {
   printNode(
       node, format("DistinctLimit[%s]", node.getLimit()), NODE_COLORS.get(NodeType.LIMIT));
   return node.getSource().accept(this, context);
 }