Search in sources :

Example 1 with TestingColumnHandle

use of com.facebook.presto.spi.TestingColumnHandle in project presto by prestodb.

the class TestTableLayoutResult method testComputeEnforced.

@Test
public void testComputeEnforced() {
    assertComputeEnforced(TupleDomain.all(), TupleDomain.all(), TupleDomain.all());
    assertComputeEnforcedFails(TupleDomain.all(), TupleDomain.none());
    assertComputeEnforced(TupleDomain.none(), TupleDomain.all(), TupleDomain.none());
    assertComputeEnforced(TupleDomain.none(), TupleDomain.none(), TupleDomain.all());
    assertComputeEnforced(TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), TupleDomain.all(), TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))));
    assertComputeEnforced(TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), TupleDomain.all());
    assertComputeEnforcedFails(TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), TupleDomain.none());
    assertComputeEnforcedFails(TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 9999L))));
    assertComputeEnforcedFails(TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c9999"), Domain.singleValue(BIGINT, 1L))));
    assertComputeEnforced(TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L), new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))), TupleDomain.all(), TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L), new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))));
    assertComputeEnforced(TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L), new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))), TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))), TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))));
    assertComputeEnforced(TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L), new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))), TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))), TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L))));
    assertComputeEnforced(TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L), new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))), TupleDomain.withColumnDomains(ImmutableMap.of(new TestingColumnHandle("c1"), Domain.singleValue(BIGINT, 1L), new TestingColumnHandle("c2"), Domain.singleValue(BIGINT, 2L))), TupleDomain.all());
}
Also used : TestingColumnHandle(com.facebook.presto.spi.TestingColumnHandle) Test(org.testng.annotations.Test)

Example 2 with TestingColumnHandle

use of com.facebook.presto.spi.TestingColumnHandle in project presto by prestodb.

the class TestSchedulingOrderVisitor method testSemiJoinOrder.

@Test
public void testSemiJoinOrder() {
    PlanBuilder planBuilder = new PlanBuilder(TEST_SESSION, new PlanNodeIdAllocator(), METADATA);
    VariableReferenceExpression sourceJoin = planBuilder.variable("sourceJoin");
    TableScanNode a = planBuilder.tableScan(ImmutableList.of(sourceJoin), ImmutableMap.of(sourceJoin, new TestingColumnHandle("sourceJoin")));
    VariableReferenceExpression filteringSource = planBuilder.variable("filteringSource");
    TableScanNode b = planBuilder.tableScan(ImmutableList.of(filteringSource), ImmutableMap.of(filteringSource, new TestingColumnHandle("filteringSource")));
    List<PlanNodeId> order = scheduleOrder(planBuilder.semiJoin(sourceJoin, filteringSource, planBuilder.variable("semiJoinOutput"), Optional.empty(), Optional.empty(), a, b));
    assertEquals(order, ImmutableList.of(b.getId(), a.getId()));
}
Also used : PlanNodeId(com.facebook.presto.spi.plan.PlanNodeId) TestingColumnHandle(com.facebook.presto.spi.TestingColumnHandle) TableScanNode(com.facebook.presto.spi.plan.TableScanNode) PlanNodeIdAllocator(com.facebook.presto.spi.plan.PlanNodeIdAllocator) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) PlanBuilder(com.facebook.presto.sql.planner.iterative.rule.test.PlanBuilder) Test(org.testng.annotations.Test)

Aggregations

TestingColumnHandle (com.facebook.presto.spi.TestingColumnHandle)2 Test (org.testng.annotations.Test)2 PlanNodeId (com.facebook.presto.spi.plan.PlanNodeId)1 PlanNodeIdAllocator (com.facebook.presto.spi.plan.PlanNodeIdAllocator)1 TableScanNode (com.facebook.presto.spi.plan.TableScanNode)1 VariableReferenceExpression (com.facebook.presto.spi.relation.VariableReferenceExpression)1 PlanBuilder (com.facebook.presto.sql.planner.iterative.rule.test.PlanBuilder)1