예제 #1
0
    @Override
    public PlanNode visitFilter(FilterNode node, RewriteContext<Void> context) {
      if (node.getSource() instanceof TableScanNode
          && !((TableScanNode) node.getSource()).getLayout().isPresent()) {
        return planTableScan((TableScanNode) node.getSource(), node.getPredicate());
      }

      return context.defaultRewrite(node);
    }
예제 #2
0
    @Override
    public PlanNode visitFilter(FilterNode node, RewriteContext<Context> context) {
      if (node.getSource() instanceof TableScanNode) {
        return planTableScan((TableScanNode) node.getSource(), node.getPredicate(), context.get());
      }

      return context.defaultRewrite(
          node, new Context(context.get().getLookupSymbols(), context.get().getSuccess()));
    }
예제 #3
0
 @Override
 public PlanNode visitFilter(FilterNode node, RewriteContext<Void> context) {
   PlanNode source = context.rewrite(node.getSource());
   Expression simplified = simplifyExpression(node.getPredicate());
   if (simplified.equals(BooleanLiteral.TRUE_LITERAL)) {
     return source;
   }
   return new FilterNode(node.getId(), source, simplified);
 }
  @Override
  public Expression visitFilter(FilterNode node, Void context) {
    Expression underlyingPredicate = node.getSource().accept(this, context);

    Expression predicate = node.getPredicate();

    // Remove non-deterministic conjuncts
    predicate = stripNonDeterministicConjuncts(predicate);

    return combineConjuncts(predicate, underlyingPredicate);
  }
예제 #5
0
    @Override
    public PlanNode visitFilter(FilterNode node, RewriteContext<Set<Symbol>> context) {
      Set<Symbol> expectedInputs =
          ImmutableSet.<Symbol>builder()
              .addAll(DependencyExtractor.extractUnique(node.getPredicate()))
              .addAll(context.get())
              .build();

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

      return new FilterNode(node.getId(), source, node.getPredicate());
    }
예제 #6
0
 @Override
 public Void visitFilter(FilterNode node, Void context) {
   String expression = node.getPredicate().toString();
   printNode(node, "Filter", expression, NODE_COLORS.get(NodeType.FILTER));
   return node.getSource().accept(this, context);
 }
예제 #7
0
 @Override
 public Map<Symbol, Symbol> visitFilter(FilterNode node, Set<Symbol> lookupSymbols) {
   return node.getSource().accept(this, lookupSymbols);
 }
 @Override
 public SubPlanBuilder visitFilter(FilterNode node, Void context) {
   SubPlanBuilder current = node.getSource().accept(this, context);
   current.setRoot(new FilterNode(node.getId(), current.getRoot(), node.getPredicate()));
   return current;
 }
예제 #9
0
 @Override
 public PlanNode rewriteFilter(
     FilterNode node, Expression inheritedPredicate, PlanRewriter<Expression> planRewriter) {
   return planRewriter.rewrite(
       node.getSource(), combineConjuncts(node.getPredicate(), inheritedPredicate));
 }