use of com.facebook.presto.sql.planner.plan.SemiJoinNode in project presto by prestodb.
the class SemiJoinMatcher 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());
SemiJoinNode semiJoinNode = (SemiJoinNode) node;
if (!(symbolAliases.get(sourceSymbolAlias).equals(semiJoinNode.getSourceJoinSymbol().toSymbolReference()) && symbolAliases.get(filteringSymbolAlias).equals(semiJoinNode.getFilteringSourceJoinSymbol().toSymbolReference()))) {
return NO_MATCH;
}
return match(outputAlias, semiJoinNode.getSemiJoinOutput().toSymbolReference());
}
use of com.facebook.presto.sql.planner.plan.SemiJoinNode in project presto by prestodb.
the class TestEffectivePredicateExtractor method testSemiJoin.
@Test
public void testSemiJoin() throws Exception {
PlanNode node = new SemiJoinNode(newId(), filter(baseTableScan, and(greaterThan(AE, bigintLiteral(10)), lessThan(AE, bigintLiteral(100)))), filter(baseTableScan, greaterThan(AE, bigintLiteral(5))), A, B, C, Optional.empty(), Optional.empty(), Optional.empty());
Expression effectivePredicate = EffectivePredicateExtractor.extract(node, TYPES);
// Currently, only pull predicates through the source plan
assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(and(greaterThan(AE, bigintLiteral(10)), lessThan(AE, bigintLiteral(100)))));
}
use of com.facebook.presto.sql.planner.plan.SemiJoinNode in project presto by prestodb.
the class PushLimitThroughSemiJoin method apply.
@Override
public Optional<PlanNode> apply(PlanNode node, Lookup lookup, PlanNodeIdAllocator idAllocator, SymbolAllocator symbolAllocator) {
if (!(node instanceof LimitNode)) {
return Optional.empty();
}
LimitNode parent = (LimitNode) node;
PlanNode child = lookup.resolve(parent.getSource());
if (!(child instanceof SemiJoinNode)) {
return Optional.empty();
}
return Optional.of(transpose(parent, child));
}
use of com.facebook.presto.sql.planner.plan.SemiJoinNode in project presto by prestodb.
the class PropertyDerivations method deriveProperties.
public static ActualProperties deriveProperties(PlanNode node, List<ActualProperties> inputProperties, Metadata metadata, Session session, Map<Symbol, Type> types, SqlParser parser) {
ActualProperties output = node.accept(new Visitor(metadata, session, types, parser), inputProperties);
// TODO: ideally this logic would be somehow moved to PlanSanityChecker
verify(node instanceof SemiJoinNode || inputProperties.stream().noneMatch(ActualProperties::isNullsReplicated) || output.isNullsReplicated(), "SemiJoinNode is the only node that can strip null replication");
return output;
}
Aggregations