Search in sources :

Example 96 with Type

use of io.prestosql.spi.type.Type in project hetu-core by openlookeng.

the class TestNestedLoopJoinOperator method testProbeAndBuildMultiplePages.

@Test
public void testProbeAndBuildMultiplePages() {
    TaskContext taskContext = createTaskContext();
    // build
    List<Type> buildTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder buildPages = rowPagesBuilder(buildTypes).row("A").row("B").pageBreak().row("C");
    // probe
    List<Type> probeTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder probePages = rowPagesBuilder(probeTypes);
    List<Page> probeInput = probePages.row("a").pageBreak().row((String) null).row("b").row("c").pageBreak().row("d").build();
    NestedLoopJoinOperatorFactory joinOperatorFactory = newJoinOperatorFactoryWithCompletedBuild(taskContext, buildPages);
    // expected
    MaterializedResult expected = resultBuilder(taskContext.getSession(), concat(probeTypes, buildPages.getTypes())).row("a", "A").row("a", "B").row("a", "C").row(null, "A").row("b", "A").row("c", "A").row(null, "B").row("b", "B").row("c", "B").row(null, "C").row("b", "C").row("c", "C").row("d", "A").row("d", "B").row("d", "C").build();
    assertOperatorEquals(joinOperatorFactory, taskContext.addPipelineContext(0, true, true, false).addDriverContext(), probeInput, expected);
}
Also used : Type(io.prestosql.spi.type.Type) TestingTaskContext(io.prestosql.testing.TestingTaskContext) RowPagesBuilder(io.prestosql.RowPagesBuilder) Page(io.prestosql.spi.Page) MaterializedResult(io.prestosql.testing.MaterializedResult) NestedLoopJoinOperatorFactory(io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory) Test(org.testng.annotations.Test)

Example 97 with Type

use of io.prestosql.spi.type.Type in project hetu-core by openlookeng.

the class TestNestedLoopJoinOperator method testProbeAndBuildMultiplePagesSnapshot.

@Test
public void testProbeAndBuildMultiplePagesSnapshot() {
    TaskContext taskContext = createTaskContext();
    // build
    List<Type> buildTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder buildPages = rowPagesBuilder(buildTypes).row("A").row("B").pageBreak().row("C");
    // probe
    List<Type> probeTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder probePages = rowPagesBuilder(probeTypes);
    List<Page> probeInput = probePages.row("a").pageBreak().row((String) null).row("b").row("c").pageBreak().row("d").build();
    NestedLoopJoinOperatorFactory joinOperatorFactory = newJoinOperatorFactoryWithCompletedBuild(taskContext, buildPages);
    // expected
    MaterializedResult expected = resultBuilder(taskContext.getSession(), concat(probeTypes, buildPages.getTypes())).row("a", "A").row("a", "B").row("a", "C").row(null, "A").row("b", "A").row("c", "A").row(null, "B").row("b", "B").row("c", "B").row(null, "C").row("b", "C").row("c", "C").row("d", "A").row("d", "B").row("d", "C").build();
    assertOperatorEqualsWithSimpleSelfStateComparison(joinOperatorFactory, taskContext.addPipelineContext(0, true, true, false).addDriverContext(), probeInput, expected, createExpectedMapping());
}
Also used : Type(io.prestosql.spi.type.Type) TestingTaskContext(io.prestosql.testing.TestingTaskContext) RowPagesBuilder(io.prestosql.RowPagesBuilder) Page(io.prestosql.spi.Page) MaterializedResult(io.prestosql.testing.MaterializedResult) NestedLoopJoinOperatorFactory(io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory) Test(org.testng.annotations.Test)

Example 98 with Type

use of io.prestosql.spi.type.Type in project hetu-core by openlookeng.

the class TestNestedLoopJoinOperator method testCrossJoinWithNullBuild.

@Test
public void testCrossJoinWithNullBuild() {
    TaskContext taskContext = createTaskContext();
    // build
    List<Type> buildTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder buildPages = rowPagesBuilder(buildTypes).row("a").row((String) null).row((String) null).row("a").row("b");
    // probe
    List<Type> probeTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder probePages = rowPagesBuilder(probeTypes);
    List<Page> probeInput = probePages.row("A").row("B").build();
    NestedLoopJoinOperatorFactory joinOperatorFactory = newJoinOperatorFactoryWithCompletedBuild(taskContext, buildPages);
    // expected
    MaterializedResult expected = resultBuilder(taskContext.getSession(), concat(probeTypes, buildPages.getTypes())).row("A", "a").row("A", null).row("A", null).row("A", "a").row("A", "b").row("B", "a").row("B", null).row("B", null).row("B", "a").row("B", "b").build();
    assertOperatorEquals(joinOperatorFactory, taskContext.addPipelineContext(0, true, true, false).addDriverContext(), probeInput, expected);
}
Also used : Type(io.prestosql.spi.type.Type) TestingTaskContext(io.prestosql.testing.TestingTaskContext) RowPagesBuilder(io.prestosql.RowPagesBuilder) Page(io.prestosql.spi.Page) MaterializedResult(io.prestosql.testing.MaterializedResult) NestedLoopJoinOperatorFactory(io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory) Test(org.testng.annotations.Test)

Example 99 with Type

use of io.prestosql.spi.type.Type in project hetu-core by openlookeng.

the class TestNestedLoopJoinOperator method testCrossJoinWithNullProbe.

@Test
public void testCrossJoinWithNullProbe() {
    TaskContext taskContext = createTaskContext();
    // build
    List<Type> buildTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder buildPages = rowPagesBuilder(buildTypes).row("a").row("b");
    // probe
    List<Type> probeTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder probePages = rowPagesBuilder(probeTypes);
    List<Page> probeInput = probePages.row("A").row((String) null).row((String) null).row("A").row("B").build();
    NestedLoopJoinOperatorFactory joinOperatorFactory = newJoinOperatorFactoryWithCompletedBuild(taskContext, buildPages);
    // expected
    MaterializedResult expected = resultBuilder(taskContext.getSession(), concat(probeTypes, buildPages.getTypes())).row("A", "a").row(null, "a").row(null, "a").row("A", "a").row("B", "a").row("A", "b").row(null, "b").row(null, "b").row("A", "b").row("B", "b").build();
    assertOperatorEquals(joinOperatorFactory, taskContext.addPipelineContext(0, true, true, false).addDriverContext(), probeInput, expected);
}
Also used : Type(io.prestosql.spi.type.Type) TestingTaskContext(io.prestosql.testing.TestingTaskContext) RowPagesBuilder(io.prestosql.RowPagesBuilder) Page(io.prestosql.spi.Page) MaterializedResult(io.prestosql.testing.MaterializedResult) NestedLoopJoinOperatorFactory(io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory) Test(org.testng.annotations.Test)

Example 100 with Type

use of io.prestosql.spi.type.Type in project hetu-core by openlookeng.

the class TestNestedLoopJoinOperator method testCrossJoinWithNullOnBothSides.

@Test
public void testCrossJoinWithNullOnBothSides() {
    TaskContext taskContext = createTaskContext();
    // build
    List<Type> buildTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder buildPages = rowPagesBuilder(buildTypes).row("a").row((String) null).row("b").row("c").row((String) null);
    // probe
    List<Type> probeTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder probePages = rowPagesBuilder(probeTypes);
    List<Page> probeInput = probePages.row("A").row("B").row((String) null).row("C").build();
    NestedLoopJoinOperatorFactory joinOperatorFactory = newJoinOperatorFactoryWithCompletedBuild(taskContext, buildPages);
    // expected
    MaterializedResult expected = resultBuilder(taskContext.getSession(), concat(probeTypes, buildPages.getTypes())).row("A", "a").row("A", null).row("A", "b").row("A", "c").row("A", null).row("B", "a").row("B", null).row("B", "b").row("B", "c").row("B", null).row(null, "a").row(null, null).row(null, "b").row(null, "c").row(null, null).row("C", "a").row("C", null).row("C", "b").row("C", "c").row("C", null).build();
    assertOperatorEquals(joinOperatorFactory, taskContext.addPipelineContext(0, true, true, false).addDriverContext(), probeInput, expected);
}
Also used : Type(io.prestosql.spi.type.Type) TestingTaskContext(io.prestosql.testing.TestingTaskContext) RowPagesBuilder(io.prestosql.RowPagesBuilder) Page(io.prestosql.spi.Page) MaterializedResult(io.prestosql.testing.MaterializedResult) NestedLoopJoinOperatorFactory(io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory) Test(org.testng.annotations.Test)

Aggregations

Type (io.prestosql.spi.type.Type)764 Test (org.testng.annotations.Test)260 ImmutableList (com.google.common.collect.ImmutableList)230 List (java.util.List)222 ArrayList (java.util.ArrayList)212 ArrayType (io.prestosql.spi.type.ArrayType)200 RowType (io.prestosql.spi.type.RowType)194 VarcharType (io.prestosql.spi.type.VarcharType)159 VarcharType.createUnboundedVarcharType (io.prestosql.spi.type.VarcharType.createUnboundedVarcharType)150 Map (java.util.Map)150 Block (io.prestosql.spi.block.Block)133 ImmutableMap (com.google.common.collect.ImmutableMap)131 Page (io.prestosql.spi.Page)129 PrestoException (io.prestosql.spi.PrestoException)123 DecimalType (io.prestosql.spi.type.DecimalType)118 HashMap (java.util.HashMap)115 Optional (java.util.Optional)113 DecimalType.createDecimalType (io.prestosql.spi.type.DecimalType.createDecimalType)112 Slice (io.airlift.slice.Slice)88 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)87