Search in sources :

Example 1 with JoinEnumerationResult

use of com.facebook.presto.sql.planner.iterative.rule.ReorderJoins.JoinEnumerationResult 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

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