Exemplo n.º 1
0
    @Override
    public ActualProperties visitDistinctLimit(
        DistinctLimitNode node, List<ActualProperties> inputProperties) {
      ActualProperties properties = Iterables.getOnlyElement(inputProperties);

      return ActualProperties.builderFrom(properties)
          .local(LocalProperties.grouped(node.getDistinctSymbols()))
          .build();
    }
    @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;
    }
Exemplo n.º 3
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());
 }
Exemplo n.º 4
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);
 }
 @Override
 public Expression visitDistinctLimit(DistinctLimitNode node, Void context) {
   return node.getSource().accept(this, context);
 }