use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestRemoveUnsupportedDynamicFilters method testRemoveDynamicFilterNotAboveTableScanWithSemiJoin.
@Test
public void testRemoveDynamicFilterNotAboveTableScanWithSemiJoin() {
PlanNode root = builder.semiJoin(builder.filter(combineConjuncts(metadata, expression("ORDERS_OK > 0"), createDynamicFilterExpression(TEST_SESSION, metadata, new DynamicFilterId("DF"), BIGINT, ordersOrderKeySymbol.toSymbolReference())), builder.values(ordersOrderKeySymbol)), lineitemTableScanNode, ordersOrderKeySymbol, lineitemOrderKeySymbol, new Symbol("SEMIJOIN_OUTPUT"), Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(new DynamicFilterId("DF")));
assertPlan(removeUnsupportedDynamicFilters(root), semiJoin("ORDERS_OK", "LINEITEM_OK", "SEMIJOIN_OUTPUT", false, filter(expression("ORDERS_OK > 0"), values("ORDERS_OK")), tableScan("lineitem", ImmutableMap.of("LINEITEM_OK", "orderkey"))));
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestRemoveUnsupportedDynamicFilters method testUnmatchedDynamicFilterInSemiJoin.
@Test
public void testUnmatchedDynamicFilterInSemiJoin() {
PlanNode root = builder.semiJoin(builder.filter(combineConjuncts(metadata, expression("ORDERS_OK > 0"), createDynamicFilterExpression(TEST_SESSION, metadata, new DynamicFilterId("DF"), BIGINT, ordersOrderKeySymbol.toSymbolReference())), ordersTableScanNode), lineitemTableScanNode, ordersOrderKeySymbol, lineitemOrderKeySymbol, new Symbol("SEMIJOIN_OUTPUT"), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
assertPlan(removeUnsupportedDynamicFilters(root), semiJoin("ORDERS_OK", "LINEITEM_OK", "SEMIJOIN_OUTPUT", false, filter(expression("ORDERS_OK > 0"), tableScan("orders", ImmutableMap.of("ORDERS_OK", "orderkey"))), tableScan("lineitem", ImmutableMap.of("LINEITEM_OK", "orderkey"))));
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestRemoveUnsupportedDynamicFilters method testUnconsumedDynamicFilterInJoin.
@Test
public void testUnconsumedDynamicFilterInJoin() {
PlanNode root = builder.join(INNER, builder.filter(expression("ORDERS_OK > 0"), ordersTableScanNode), lineitemTableScanNode, ImmutableList.of(new JoinNode.EquiJoinClause(ordersOrderKeySymbol, lineitemOrderKeySymbol)), ImmutableList.of(ordersOrderKeySymbol), ImmutableList.of(), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableMap.of(new DynamicFilterId("DF"), lineitemOrderKeySymbol));
assertPlan(removeUnsupportedDynamicFilters(root), join(INNER, ImmutableList.of(equiJoinClause("ORDERS_OK", "LINEITEM_OK")), ImmutableMap.of(), PlanMatchPattern.filter(expression("ORDERS_OK > 0"), TRUE_LITERAL, tableScan("orders", ImmutableMap.of("ORDERS_OK", "orderkey"))), tableScan("lineitem", ImmutableMap.of("LINEITEM_OK", "orderkey"))));
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestRemoveUnsupportedDynamicFilters method testSpatialJoin.
@Test
public void testSpatialJoin() {
Symbol leftSymbol = builder.symbol("LEFT_SYMBOL", BIGINT);
Symbol rightSymbol = builder.symbol("RIGHT_SYMBOL", BIGINT);
PlanNode root = builder.output(ImmutableList.of(), ImmutableList.of(), builder.spatialJoin(SpatialJoinNode.Type.INNER, builder.values(leftSymbol), builder.values(rightSymbol), ImmutableList.of(leftSymbol, rightSymbol), createDynamicFilterExpression(TEST_SESSION, metadata, new DynamicFilterId("DF"), BIGINT, expression("LEFT_SYMBOL + RIGHT_SYMBOL"))));
assertPlan(removeUnsupportedDynamicFilters(root), output(spatialJoin("true", values("LEFT_SYMBOL"), values("RIGHT_SYMBOL"))));
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestRemoveUnsupportedDynamicFilters method testNestedDynamicFilterDisjunctionRewrite.
@Test
public void testNestedDynamicFilterDisjunctionRewrite() {
PlanNode root = builder.output(ImmutableList.of(), ImmutableList.of(), builder.join(INNER, ordersTableScanNode, builder.filter(combineConjuncts(metadata, combineDisjuncts(metadata, expression("LINEITEM_OK IS NULL"), createDynamicFilterExpression(TEST_SESSION, metadata, new DynamicFilterId("DF"), BIGINT, lineitemOrderKeySymbol.toSymbolReference())), combineDisjuncts(metadata, expression("LINEITEM_OK IS NOT NULL"), createDynamicFilterExpression(TEST_SESSION, metadata, new DynamicFilterId("DF"), BIGINT, lineitemOrderKeySymbol.toSymbolReference()))), lineitemTableScanNode), ImmutableList.of(new JoinNode.EquiJoinClause(ordersOrderKeySymbol, lineitemOrderKeySymbol)), ImmutableList.of(ordersOrderKeySymbol), ImmutableList.of(), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableMap.of()));
assertPlan(removeUnsupportedDynamicFilters(root), output(join(INNER, ImmutableList.of(equiJoinClause("ORDERS_OK", "LINEITEM_OK")), ImmutableMap.of(), tableScan("orders", ImmutableMap.of("ORDERS_OK", "orderkey")), tableScan("lineitem", ImmutableMap.of("LINEITEM_OK", "orderkey")))));
}
Aggregations