use of io.prestosql.testing.MaterializedResult in project hetu-core by openlookeng.
the class TestMergeSortedPages method testSingleStream.
@Test
public void testSingleStream() {
List<Type> types = ImmutableList.of(INTEGER, INTEGER);
MaterializedResult actual = mergeSortedPages(types, ImmutableList.of(0, 1), ImmutableList.of(ASC_NULLS_FIRST, DESC_NULLS_FIRST), ImmutableList.of(rowPagesBuilder(types).row(1, 4).row(2, 3).pageBreak().row(3, 2).row(4, 1).build()));
MaterializedResult expected = resultBuilder(TEST_SESSION, types).row(1, 4).row(2, 3).row(3, 2).row(4, 1).build();
assertEquals(actual, expected);
}
use of io.prestosql.testing.MaterializedResult in project hetu-core by openlookeng.
the class AbstractTestAggregations method testGroupByNan.
@Test
public void testGroupByNan() {
MaterializedResult actual = computeActual("SELECT * FROM (VALUES nan(), nan(), nan()) GROUP BY 1");
assertTrue(Double.isNaN((Double) actual.getOnlyValue()));
}
use of io.prestosql.testing.MaterializedResult in project hetu-core by openlookeng.
the class AbstractTestAggregations method testGroupByNanMap.
@Test
public void testGroupByNanMap() {
MaterializedResult actual = computeActual("SELECT MAP_KEYS(x)[1] FROM (VALUES MAP(ARRAY[nan()], ARRAY[ARRAY[1]]), MAP(ARRAY[nan()], ARRAY[ARRAY[2]])) t(x) GROUP BY 1");
assertTrue(Double.isNaN((Double) actual.getOnlyValue()));
}
use of io.prestosql.testing.MaterializedResult in project hetu-core by openlookeng.
the class AbstractTestAggregations method testGroupByNanRow.
@Test
public void testGroupByNanRow() {
MaterializedResult actual = computeActual("SELECT a, b, c FROM (VALUES ROW(nan(), 1, 2), ROW(nan(), 1, 2)) t(a, b, c) GROUP BY 1, 2, 3");
List<MaterializedRow> actualRows = actual.getMaterializedRows();
assertEquals(actualRows.size(), 1);
assertTrue(Double.isNaN((Double) actualRows.get(0).getField(0)));
assertEquals(actualRows.get(0).getField(1), 1);
assertEquals(actualRows.get(0).getField(2), 2);
}
use of io.prestosql.testing.MaterializedResult in project hetu-core by openlookeng.
the class AbstractTestAggregations method testGroupByNanArray.
@Test
public void testGroupByNanArray() {
MaterializedResult actual = computeActual("SELECT a FROM (VALUES (ARRAY[nan(), 2e0, 3e0]), (ARRAY[nan(), 2e0, 3e0])) t(a) GROUP BY a");
List<MaterializedRow> actualRows = actual.getMaterializedRows();
assertEquals(actualRows.size(), 1);
assertTrue(Double.isNaN(((List<Double>) actualRows.get(0).getField(0)).get(0)));
assertEquals(((List<Double>) actualRows.get(0).getField(0)).get(1), 2.0);
assertEquals(((List<Double>) actualRows.get(0).getField(0)).get(2), 3.0);
}
Aggregations