use of io.trino.RowPagesBuilder in project trino by trinodb.
the class TestSpatialJoinOperator method testSpatialLeftJoin.
@Test
public void testSpatialLeftJoin() {
TaskContext taskContext = createTaskContext();
RowPagesBuilder buildPages = rowPagesBuilder(ImmutableList.of(GEOMETRY, VARCHAR)).row(POLYGON_A, "A").row(null, "null").pageBreak().row(POLYGON_B, "B");
RowPagesBuilder probePages = rowPagesBuilder(ImmutableList.of(GEOMETRY, VARCHAR)).row(POINT_X, "x").row(null, "null").row(POINT_Y, "y").pageBreak().row(POINT_Z, "z").pageBreak().row(POINT_W, "w");
MaterializedResult expected = resultBuilder(taskContext.getSession(), ImmutableList.of(VARCHAR, VARCHAR)).row("x", "A").row("null", null).row("y", "A").row("y", "B").row("z", "B").row("w", null).build();
assertSpatialJoin(taskContext, LEFT, buildPages, probePages, expected);
}
use of io.trino.RowPagesBuilder in project trino by trinodb.
the class TestSpatialJoinOperator method testEmptyProbe.
@Test
public void testEmptyProbe() {
TaskContext taskContext = createTaskContext();
RowPagesBuilder buildPages = rowPagesBuilder(ImmutableList.of(GEOMETRY, VARCHAR)).row(POLYGON_A, "A").row(null, "null").pageBreak().row(POLYGON_B, "B");
RowPagesBuilder probePages = rowPagesBuilder(ImmutableList.of(GEOMETRY, VARCHAR));
MaterializedResult expected = resultBuilder(taskContext.getSession(), ImmutableList.of(VARCHAR, VARCHAR)).build();
assertSpatialJoin(taskContext, INNER, buildPages, probePages, expected);
}
use of io.trino.RowPagesBuilder in project trino by trinodb.
the class TestDistinctLimitOperator method testDistinctLimitValuesLessThanLimit.
@Test(dataProvider = "hashEnabledValues")
public void testDistinctLimitValuesLessThanLimit(boolean hashEnabled) {
RowPagesBuilder rowPagesBuilder = rowPagesBuilder(hashEnabled, Ints.asList(0), BIGINT);
List<Page> input = rowPagesBuilder.addSequencePage(3, 1).addSequencePage(3, 2).build();
OperatorFactory operatorFactory = new DistinctLimitOperator.DistinctLimitOperatorFactory(0, new PlanNodeId("test"), rowPagesBuilder.getTypes(), Ints.asList(0), 5, rowPagesBuilder.getHashChannel(), joinCompiler, blockTypeOperators);
MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT).row(1L).row(2L).row(3L).row(4L).build();
assertOperatorEquals(operatorFactory, driverContext, input, expected, hashEnabled, ImmutableList.of(1));
}
use of io.trino.RowPagesBuilder in project trino by trinodb.
the class TestStreamingAggregationOperator method testEmptyInput.
@Test
public void testEmptyInput() {
RowPagesBuilder rowPagesBuilder = RowPagesBuilder.rowPagesBuilder(BOOLEAN, VARCHAR, BIGINT);
List<Page> input = rowPagesBuilder.build();
MaterializedResult expected = resultBuilder(driverContext.getSession(), VARCHAR, BIGINT, BIGINT).build();
assertOperatorEquals(operatorFactory, driverContext, input, expected);
}
use of io.trino.RowPagesBuilder in project trino by trinodb.
the class TestStreamingAggregationOperator method testUniqueGroupingValues.
@Test
public void testUniqueGroupingValues() {
RowPagesBuilder rowPagesBuilder = RowPagesBuilder.rowPagesBuilder(BOOLEAN, VARCHAR, BIGINT);
List<Page> input = rowPagesBuilder.addSequencePage(10, 0, 0, 0).addSequencePage(10, 0, 10, 10).build();
MaterializedResult.Builder builder = resultBuilder(driverContext.getSession(), VARCHAR, BIGINT, BIGINT);
for (int i = 0; i < 20; i++) {
builder.row(format("%s", i), 1L, Long.valueOf(i));
}
assertOperatorEquals(operatorFactory, driverContext, input, builder.build());
}
Aggregations