use of io.trino.operator.WindowOperator.WindowOperatorFactory in project trino by trinodb.
the class TestWindowOperator method testPartiallyPreGroupedPartitionWithEmptyInput.
@Test(dataProvider = "spillEnabled")
public void testPartiallyPreGroupedPartitionWithEmptyInput(boolean spillEnabled, boolean revokeMemoryWhenAddingPages, long memoryLimit) {
List<Page> input = rowPagesBuilder(BIGINT, VARCHAR, BIGINT, VARCHAR).pageBreak().pageBreak().build();
WindowOperatorFactory operatorFactory = createFactoryUnbounded(ImmutableList.of(BIGINT, VARCHAR, BIGINT, VARCHAR), Ints.asList(0, 1, 2, 3), ROW_NUMBER, Ints.asList(0, 1), Ints.asList(1), Ints.asList(3), ImmutableList.of(SortOrder.ASC_NULLS_LAST), 0, spillEnabled);
DriverContext driverContext = createDriverContext(memoryLimit);
MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT, VARCHAR, BIGINT, VARCHAR, BIGINT).build();
assertOperatorEquals(operatorFactory, driverContext, input, expected, revokeMemoryWhenAddingPages);
}
use of io.trino.operator.WindowOperator.WindowOperatorFactory in project trino by trinodb.
the class TestWindowOperator method testDistinctPartitionAndPeers.
@Test(dataProvider = "spillEnabled")
public void testDistinctPartitionAndPeers(boolean spillEnabled, boolean revokeMemoryWhenAddingPages, long memoryLimit) {
List<Page> input = rowPagesBuilder(DOUBLE, DOUBLE).row(1.0, 1.0).row(1.0, 0.0).row(1.0, Double.NaN).row(1.0, null).row(2.0, 2.0).row(2.0, Double.NaN).row(Double.NaN, Double.NaN).row(Double.NaN, Double.NaN).row(null, null).row(null, 1.0).row(null, null).pageBreak().row(1.0, Double.NaN).row(1.0, null).row(2.0, 2.0).row(2.0, null).row(Double.NaN, 3.0).row(Double.NaN, null).row(null, 2.0).row(null, null).build();
WindowOperatorFactory operatorFactory = createFactoryUnbounded(ImmutableList.of(DOUBLE, DOUBLE), Ints.asList(0, 1), RANK, Ints.asList(0), Ints.asList(1), ImmutableList.copyOf(new SortOrder[] { SortOrder.ASC_NULLS_LAST }), spillEnabled);
DriverContext driverContext = createDriverContext(memoryLimit);
MaterializedResult expected = resultBuilder(driverContext.getSession(), DOUBLE, DOUBLE, BIGINT).row(1.0, 0.0, 1L).row(1.0, 1.0, 2L).row(1.0, Double.NaN, 3L).row(1.0, Double.NaN, 3L).row(1.0, null, 5L).row(1.0, null, 5L).row(2.0, 2.0, 1L).row(2.0, 2.0, 1L).row(2.0, Double.NaN, 3L).row(2.0, null, 4L).row(Double.NaN, 3.0, 1L).row(Double.NaN, Double.NaN, 2L).row(Double.NaN, Double.NaN, 2L).row(Double.NaN, null, 4L).row(null, 1.0, 1L).row(null, 2.0, 2L).row(null, null, 3L).row(null, null, 3L).row(null, null, 3L).build();
assertOperatorEquals(operatorFactory, driverContext, input, expected, revokeMemoryWhenAddingPages);
}
Aggregations