use of com.facebook.presto.sql.planner.plan.FilterNode in project presto by prestodb.
the class TestSimplifyExpressions method simplifyExpressions.
private static Expression simplifyExpressions(Expression expression) {
PlanNodeIdAllocator planNodeIdAllocator = new PlanNodeIdAllocator();
FilterNode filterNode = new FilterNode(planNodeIdAllocator.getNextId(), new ValuesNode(planNodeIdAllocator.getNextId(), emptyList(), emptyList()), expression);
FilterNode simplifiedNode = (FilterNode) SIMPLIFIER.optimize(filterNode, TEST_SESSION, booleanSymbolTypeMapFor(expression), new SymbolAllocator(), planNodeIdAllocator);
return simplifiedNode.getPredicate();
}
use of com.facebook.presto.sql.planner.plan.FilterNode in project presto by prestodb.
the class MergeFilters method apply.
@Override
public Optional<PlanNode> apply(PlanNode node, Lookup lookup, PlanNodeIdAllocator idAllocator, SymbolAllocator symbolAllocator) {
if (!(node instanceof FilterNode)) {
return Optional.empty();
}
FilterNode parent = (FilterNode) node;
PlanNode source = lookup.resolve(parent.getSource());
if (!(source instanceof FilterNode)) {
return Optional.empty();
}
FilterNode child = (FilterNode) source;
return Optional.of(new FilterNode(parent.getId(), child.getSource(), combineConjuncts(child.getPredicate(), parent.getPredicate())));
}
use of com.facebook.presto.sql.planner.plan.FilterNode in project presto by prestodb.
the class FilterMatcher method detailMatches.
@Override
public MatchResult detailMatches(PlanNode node, Session session, Metadata metadata, SymbolAliases symbolAliases) {
checkState(shapeMatches(node), "Plan testing framework error: shapeMatches returned false in detailMatches in %s", this.getClass().getName());
FilterNode filterNode = (FilterNode) node;
ExpressionVerifier verifier = new ExpressionVerifier(symbolAliases);
return new MatchResult(verifier.process(filterNode.getPredicate(), predicate));
}
Aggregations