Search in sources :

Example 1 with JoinEnumerationResult

use of io.trino.sql.planner.iterative.rule.ReorderJoins.JoinEnumerationResult in project trino by trinodb.

the class TestJoinEnumerator method testDoesNotCreateJoinWhenPartitionedOnCrossJoin.

@Test
public void testDoesNotCreateJoinWhenPartitionedOnCrossJoin() {
    PlanNodeIdAllocator idAllocator = new PlanNodeIdAllocator();
    PlanBuilder p = new PlanBuilder(idAllocator, queryRunner.getMetadata(), queryRunner.getDefaultSession());
    Symbol a1 = p.symbol("A1");
    Symbol b1 = p.symbol("B1");
    MultiJoinNode multiJoinNode = new MultiJoinNode(new LinkedHashSet<>(ImmutableList.of(p.values(a1), p.values(b1))), TRUE_LITERAL, ImmutableList.of(a1, b1), false);
    JoinEnumerator joinEnumerator = new JoinEnumerator(queryRunner.getMetadata(), new CostComparator(1, 1, 1), multiJoinNode.getFilter(), createContext());
    JoinEnumerationResult actual = joinEnumerator.createJoinAccordingToPartitioning(multiJoinNode.getSources(), multiJoinNode.getOutputSymbols(), ImmutableSet.of(0));
    assertFalse(actual.getPlanNode().isPresent());
    assertEquals(actual.getCost(), PlanCostEstimate.infinite());
}
Also used : CostComparator(io.trino.cost.CostComparator) JoinEnumerator(io.trino.sql.planner.iterative.rule.ReorderJoins.JoinEnumerator) PlanNodeIdAllocator(io.trino.sql.planner.PlanNodeIdAllocator) Symbol(io.trino.sql.planner.Symbol) JoinEnumerationResult(io.trino.sql.planner.iterative.rule.ReorderJoins.JoinEnumerationResult) PlanBuilder(io.trino.sql.planner.iterative.rule.test.PlanBuilder) MultiJoinNode(io.trino.sql.planner.iterative.rule.ReorderJoins.MultiJoinNode) Test(org.testng.annotations.Test)

Aggregations

CostComparator (io.trino.cost.CostComparator)1 PlanNodeIdAllocator (io.trino.sql.planner.PlanNodeIdAllocator)1 Symbol (io.trino.sql.planner.Symbol)1 JoinEnumerationResult (io.trino.sql.planner.iterative.rule.ReorderJoins.JoinEnumerationResult)1 JoinEnumerator (io.trino.sql.planner.iterative.rule.ReorderJoins.JoinEnumerator)1 MultiJoinNode (io.trino.sql.planner.iterative.rule.ReorderJoins.MultiJoinNode)1 PlanBuilder (io.trino.sql.planner.iterative.rule.test.PlanBuilder)1 Test (org.testng.annotations.Test)1