use of com.facebook.presto.spi.plan.PlanNode in project presto by prestodb.
the class TestRemoveUnsupportedDynamicFilters method testNestedDynamicFilterDisjunctionRewrite.
@Test
public void testNestedDynamicFilterDisjunctionRewrite() {
PlanNode root = builder.output(ImmutableList.of(), ImmutableList.of(), builder.join(INNER, ordersTableScanNode, builder.filter(logicalRowExpressions.combineConjuncts(logicalRowExpressions.combineDisjuncts(builder.rowExpression("LINEITEM_OK IS NULL"), createDynamicFilterExpression("DF", lineitemOrderKeyVariable, metadata.getFunctionAndTypeManager())), logicalRowExpressions.combineDisjuncts(builder.rowExpression("LINEITEM_OK IS NOT NULL"), createDynamicFilterExpression("DF", lineitemOrderKeyVariable, metadata.getFunctionAndTypeManager()))), lineitemTableScanNode), ImmutableList.of(new JoinNode.EquiJoinClause(ordersOrderKeyVariable, lineitemOrderKeyVariable)), ImmutableList.of(ordersOrderKeyVariable), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableMap.of()));
assertPlan(removeUnsupportedDynamicFilters(root), output(join(INNER, ImmutableList.of(equiJoinClause("ORDERS_OK", "LINEITEM_OK")), tableScan("orders", ImmutableMap.of("ORDERS_OK", "orderkey")), tableScan("lineitem", ImmutableMap.of("LINEITEM_OK", "orderkey")))));
}
use of com.facebook.presto.spi.plan.PlanNode in project presto by prestodb.
the class TestUnion method testUnionUnderTopN.
@Test
public void testUnionUnderTopN() {
Plan plan = plan("SELECT * FROM (" + " SELECT regionkey FROM nation " + " UNION ALL " + " SELECT nationkey FROM nation" + ") t(a) " + "ORDER BY a LIMIT 1", LogicalPlanner.Stage.OPTIMIZED_AND_VALIDATED, false);
List<PlanNode> remotes = searchFrom(plan.getRoot()).where(TestUnion::isRemoteExchange).findAll();
assertEquals(remotes.size(), 1, "There should be exactly one RemoteExchange");
assertEquals(((ExchangeNode) Iterables.getOnlyElement(remotes)).getType(), GATHER);
int numberOfpartialTopN = searchFrom(plan.getRoot()).where(planNode -> planNode instanceof TopNNode && ((TopNNode) planNode).getStep().equals(TopNNode.Step.PARTIAL)).count();
assertEquals(numberOfpartialTopN, 2, "There should be exactly two partial TopN nodes");
assertPlanIsFullyDistributed(plan);
}
use of com.facebook.presto.spi.plan.PlanNode in project presto by prestodb.
the class TestUnion method testUnionOverSingleNodeAggregationAndUnion.
@Test
public void testUnionOverSingleNodeAggregationAndUnion() {
Plan plan = plan("SELECT count(*) FROM (" + "SELECT 1 FROM nation GROUP BY regionkey " + "UNION ALL (" + " SELECT 1 FROM nation " + " UNION ALL " + " SELECT 1 FROM nation))", LogicalPlanner.Stage.OPTIMIZED_AND_VALIDATED, false);
List<PlanNode> remotes = searchFrom(plan.getRoot()).where(TestUnion::isRemoteExchange).findAll();
assertEquals(remotes.size(), 2, "There should be exactly two RemoteExchanges");
assertEquals(((ExchangeNode) remotes.get(0)).getType(), GATHER);
assertEquals(((ExchangeNode) remotes.get(1)).getType(), REPARTITION);
}
use of com.facebook.presto.spi.plan.PlanNode in project presto by prestodb.
the class TestUnion method testSimpleUnion.
@Test
public void testSimpleUnion() {
Plan plan = plan("SELECT suppkey FROM supplier UNION ALL SELECT nationkey FROM nation", LogicalPlanner.Stage.OPTIMIZED_AND_VALIDATED, false);
List<PlanNode> remotes = searchFrom(plan.getRoot()).where(TestUnion::isRemoteExchange).findAll();
assertEquals(remotes.size(), 1, "There should be exactly one RemoteExchange");
assertEquals(((ExchangeNode) Iterables.getOnlyElement(remotes)).getType(), GATHER);
assertPlanIsFullyDistributed(plan);
}
use of com.facebook.presto.spi.plan.PlanNode in project presto by prestodb.
the class TestDynamicFiltersChecker method testDynamicFilterConsumedOnBuildSide.
@Test(expectedExceptions = VerifyException.class, expectedExceptionsMessageRegExp = "Dynamic filters \\[DF\\] present in join were consumed by its build side. consumedBuildSide \\[DF\\], currentJoinDynamicFilters \\[DF\\]")
public void testDynamicFilterConsumedOnBuildSide() {
PlanNode root = builder.join(INNER, builder.filter(createDynamicFilterExpression("DF", ordersOrderKeyVariable, metadata.getFunctionAndTypeManager()), ordersTableScanNode), builder.filter(createDynamicFilterExpression("DF", ordersOrderKeyVariable, metadata.getFunctionAndTypeManager()), lineitemTableScanNode), ImmutableList.of(new JoinNode.EquiJoinClause(ordersOrderKeyVariable, lineitemOrderKeyVariable)), ImmutableList.of(ordersOrderKeyVariable), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableMap.of("DF", lineitemOrderKeyVariable));
validatePlan(root);
}
Aggregations