Search in sources :

Example 1 with JoinEnumerator

use of io.prestosql.sql.planner.iterative.rule.ReorderJoins.JoinEnumerator in project hetu-core by openlookeng.

the class TestJoinEnumerator method testDoesNotCreateJoinWhenPartitionedOnCrossJoin.

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

Aggregations

CostComparator (io.prestosql.cost.CostComparator)1 LogicalRowExpressions (io.prestosql.expressions.LogicalRowExpressions)1 PlanNodeIdAllocator (io.prestosql.spi.plan.PlanNodeIdAllocator)1 Symbol (io.prestosql.spi.plan.Symbol)1 JoinEnumerationResult (io.prestosql.sql.planner.iterative.rule.ReorderJoins.JoinEnumerationResult)1 JoinEnumerator (io.prestosql.sql.planner.iterative.rule.ReorderJoins.JoinEnumerator)1 MultiJoinNode (io.prestosql.sql.planner.iterative.rule.ReorderJoins.MultiJoinNode)1 PlanBuilder (io.prestosql.sql.planner.iterative.rule.test.PlanBuilder)1 FunctionResolution (io.prestosql.sql.relational.FunctionResolution)1 RowExpressionDeterminismEvaluator (io.prestosql.sql.relational.RowExpressionDeterminismEvaluator)1 Test (org.testng.annotations.Test)1