use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestRemoveUnsupportedDynamicFilters method testRemoveDynamicFilterNotAboveTableScan.
@Test
public void testRemoveDynamicFilterNotAboveTableScan() {
PlanNode root = builder.output(ImmutableList.of(), ImmutableList.of(), builder.join(INNER, builder.filter(combineConjuncts(metadata, expression("LINEITEM_OK > 0"), createDynamicFilterExpression(TEST_SESSION, metadata, new DynamicFilterId("DF"), BIGINT, ordersOrderKeySymbol.toSymbolReference())), builder.values(lineitemOrderKeySymbol)), ordersTableScanNode, ImmutableList.of(new JoinNode.EquiJoinClause(lineitemOrderKeySymbol, ordersOrderKeySymbol)), ImmutableList.of(), ImmutableList.of(), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableMap.of(new DynamicFilterId("DF"), ordersOrderKeySymbol)));
assertPlan(removeUnsupportedDynamicFilters(root), output(join(INNER, ImmutableList.of(equiJoinClause("LINEITEM_OK", "ORDERS_OK")), ImmutableMap.of(), filter(expression("LINEITEM_OK > 0"), values("LINEITEM_OK")), tableScan("orders", ImmutableMap.of("ORDERS_OK", "orderkey")))));
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestRemoveUnsupportedDynamicFilters method testDynamicFilterConsumedOnBuildSide.
@Test
public void testDynamicFilterConsumedOnBuildSide() {
Expression dynamicFilter = createDynamicFilterExpression(TEST_SESSION, metadata, new DynamicFilterId("DF"), BIGINT, ordersOrderKeySymbol.toSymbolReference());
PlanNode root = builder.join(INNER, builder.filter(dynamicFilter, ordersTableScanNode), builder.filter(dynamicFilter, 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("ORDERS_OK", "LINEITEM_OK"), PlanMatchPattern.filter(TRUE_LITERAL, createDynamicFilterExpression(TEST_SESSION, metadata, new DynamicFilterId("DF"), BIGINT, new SymbolReference("ORDERS_OK")), 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 testDynamicFilterConsumedOnFilteringSourceSideInSemiJoin.
@Test
public void testDynamicFilterConsumedOnFilteringSourceSideInSemiJoin() {
PlanNode root = builder.semiJoin(ordersTableScanNode, builder.filter(combineConjuncts(metadata, expression("LINEITEM_OK > 0"), createDynamicFilterExpression(TEST_SESSION, metadata, new DynamicFilterId("DF"), BIGINT, lineitemOrderKeySymbol.toSymbolReference())), 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, tableScan("orders", ImmutableMap.of("ORDERS_OK", "orderkey")), filter(expression("LINEITEM_OK > 0"), tableScan("lineitem", ImmutableMap.of("LINEITEM_OK", "orderkey")))));
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestRemoveUnsupportedDynamicFilters method testNestedDynamicFilterConjunctionRewrite.
@Test
public void testNestedDynamicFilterConjunctionRewrite() {
PlanNode root = builder.output(ImmutableList.of(), ImmutableList.of(), builder.join(INNER, ordersTableScanNode, builder.filter(combineDisjuncts(metadata, combineConjuncts(metadata, expression("LINEITEM_OK IS NULL"), createDynamicFilterExpression(TEST_SESSION, metadata, new DynamicFilterId("DF"), BIGINT, lineitemOrderKeySymbol.toSymbolReference())), combineConjuncts(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")), filter(combineDisjuncts(metadata, expression("LINEITEM_OK IS NULL"), expression("LINEITEM_OK IS NOT NULL")), tableScan("lineitem", ImmutableMap.of("LINEITEM_OK", "orderkey"))))));
}
use of io.trino.sql.planner.plan.DynamicFilterId in project trino by trinodb.
the class TestRemoveUnsupportedDynamicFilters method testUnmatchedDynamicFilter.
@Test
public void testUnmatchedDynamicFilter() {
PlanNode root = builder.output(ImmutableList.of(), ImmutableList.of(), builder.join(INNER, ordersTableScanNode, builder.filter(combineConjuncts(metadata, expression("LINEITEM_OK > 0"), createDynamicFilterExpression(TEST_SESSION, metadata, new DynamicFilterId("DF"), BIGINT, lineitemOrderKeySymbol.toSymbolReference())), lineitemTableScanNode), ImmutableList.of(new JoinNode.EquiJoinClause(ordersOrderKeySymbol, lineitemOrderKeySymbol)), ImmutableList.of(), 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")), filter(expression("LINEITEM_OK > 0"), tableScan("lineitem", ImmutableMap.of("LINEITEM_OK", "orderkey"))))));
}
Aggregations