Search in sources :

Example 6 with MultiJoinNode

use of com.facebook.presto.sql.planner.iterative.rule.ReorderJoins.MultiJoinNode in project presto by prestodb.

the class TestJoinEnumerator method testDoesNotCreateJoinWhenPartitionedOnCrossJoin.

@Test
public void testDoesNotCreateJoinWhenPartitionedOnCrossJoin() {
    PlanNodeIdAllocator idAllocator = new PlanNodeIdAllocator();
    PlanBuilder p = new PlanBuilder(TEST_SESSION, idAllocator, queryRunner.getMetadata());
    VariableReferenceExpression a1 = p.variable("A1");
    VariableReferenceExpression b1 = p.variable("B1");
    MultiJoinNode multiJoinNode = new MultiJoinNode(new LinkedHashSet<>(ImmutableList.of(p.values(a1), p.values(b1))), TRUE_CONSTANT, ImmutableList.of(a1, b1));
    JoinEnumerator joinEnumerator = new JoinEnumerator(new CostComparator(1, 1, 1), multiJoinNode.getFilter(), createContext(), determinismEvaluator, functionResolution, metadata);
    JoinEnumerationResult actual = joinEnumerator.createJoinAccordingToPartitioning(multiJoinNode.getSources(), multiJoinNode.getOutputVariables(), ImmutableSet.of(0));
    assertFalse(actual.getPlanNode().isPresent());
    assertEquals(actual.getCost(), PlanCostEstimate.infinite());
}
Also used : CostComparator(com.facebook.presto.cost.CostComparator) JoinEnumerator(com.facebook.presto.sql.planner.iterative.rule.ReorderJoins.JoinEnumerator) PlanNodeIdAllocator(com.facebook.presto.spi.plan.PlanNodeIdAllocator) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) JoinEnumerationResult(com.facebook.presto.sql.planner.iterative.rule.ReorderJoins.JoinEnumerationResult) PlanBuilder(com.facebook.presto.sql.planner.iterative.rule.test.PlanBuilder) MultiJoinNode(com.facebook.presto.sql.planner.iterative.rule.ReorderJoins.MultiJoinNode) Test(org.testng.annotations.Test)

Aggregations

VariableReferenceExpression (com.facebook.presto.spi.relation.VariableReferenceExpression)6 MultiJoinNode (com.facebook.presto.sql.planner.iterative.rule.ReorderJoins.MultiJoinNode)6 PlanBuilder (com.facebook.presto.sql.planner.iterative.rule.test.PlanBuilder)6 Test (org.testng.annotations.Test)6 ValuesNode (com.facebook.presto.spi.plan.ValuesNode)5 MultiJoinNode.toMultiJoinNode (com.facebook.presto.sql.planner.iterative.rule.ReorderJoins.MultiJoinNode.toMultiJoinNode)5 JoinNode (com.facebook.presto.sql.planner.plan.JoinNode)5 CostComparator (com.facebook.presto.cost.CostComparator)1 PlanNodeIdAllocator (com.facebook.presto.spi.plan.PlanNodeIdAllocator)1 RowExpression (com.facebook.presto.spi.relation.RowExpression)1 JoinEnumerationResult (com.facebook.presto.sql.planner.iterative.rule.ReorderJoins.JoinEnumerationResult)1 JoinEnumerator (com.facebook.presto.sql.planner.iterative.rule.ReorderJoins.JoinEnumerator)1