@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()));
    }
Beispiel #2
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);
    }
 @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);
  }
    @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());
    }
    @Override
    public ActualProperties visitFilter(FilterNode node, List<ActualProperties> inputProperties) {
      ActualProperties properties = Iterables.getOnlyElement(inputProperties);

      DomainTranslator.ExtractionResult decomposedPredicate =
          DomainTranslator.fromPredicate(metadata, session, node.getPredicate(), types);

      Map<Symbol, NullableValue> constants = new HashMap<>(properties.getConstants());
      constants.putAll(
          extractFixedValues(decomposedPredicate.getTupleDomain()).orElse(ImmutableMap.of()));

      return ActualProperties.builderFrom(properties).constants(constants).build();
    }
 @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);
 }
 @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;
 }
Beispiel #10
0
 @Override
 public PlanNode rewriteFilter(
     FilterNode node, Expression inheritedPredicate, PlanRewriter<Expression> planRewriter) {
   return planRewriter.rewrite(
       node.getSource(), combineConjuncts(node.getPredicate(), inheritedPredicate));
 }