Exemplo n.º 1
0
 @Override
 public PlanNode visitProject(ProjectNode node, RewriteContext<Void> context) {
   PlanNode source = context.rewrite(node.getSource());
   Map<Symbol, Expression> assignments =
       ImmutableMap.copyOf(
           Maps.transformValues(node.getAssignments(), this::simplifyExpression));
   return new ProjectNode(node.getId(), source, assignments);
 }
Exemplo n.º 2
0
    @Override
    public PlanNode visitProject(ProjectNode node, RewriteContext<Set<Symbol>> context) {
      ImmutableSet.Builder<Symbol> expectedInputs = ImmutableSet.builder();

      ImmutableMap.Builder<Symbol, Expression> builder = ImmutableMap.builder();
      for (int i = 0; i < node.getOutputSymbols().size(); i++) {
        Symbol output = node.getOutputSymbols().get(i);
        Expression expression = node.getAssignments().get(output);

        if (context.get().contains(output)) {
          expectedInputs.addAll(DependencyExtractor.extractUnique(expression));
          builder.put(output, expression);
        }
      }

      PlanNode source = context.rewrite(node.getSource(), expectedInputs.build());

      return new ProjectNode(node.getId(), source, builder.build());
    }
 @Override
 public SubPlanBuilder visitProject(ProjectNode node, Void context) {
   SubPlanBuilder current = node.getSource().accept(this, context);
   current.setRoot(new ProjectNode(node.getId(), current.getRoot(), node.getOutputMap()));
   return current;
 }