Search in sources :

Example 11 with MaterializedResult

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);
}
Also used : Type(io.prestosql.spi.type.Type) OperatorAssertion.toMaterializedResult(io.prestosql.operator.OperatorAssertion.toMaterializedResult) MaterializedResult(io.prestosql.testing.MaterializedResult) Test(org.testng.annotations.Test)

Example 12 with MaterializedResult

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()));
}
Also used : MaterializedResult(io.prestosql.testing.MaterializedResult) Test(org.testng.annotations.Test)

Example 13 with MaterializedResult

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()));
}
Also used : MaterializedResult(io.prestosql.testing.MaterializedResult) Test(org.testng.annotations.Test)

Example 14 with MaterializedResult

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);
}
Also used : MaterializedResult(io.prestosql.testing.MaterializedResult) MaterializedRow(io.prestosql.testing.MaterializedRow) Test(org.testng.annotations.Test)

Example 15 with MaterializedResult

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);
}
Also used : List(java.util.List) MaterializedResult(io.prestosql.testing.MaterializedResult) MaterializedRow(io.prestosql.testing.MaterializedRow) Test(org.testng.annotations.Test)

Aggregations

MaterializedResult (io.prestosql.testing.MaterializedResult)562 Test (org.testng.annotations.Test)474 Page (io.prestosql.spi.Page)139 AbstractTestIntegrationSmokeTest (io.prestosql.tests.AbstractTestIntegrationSmokeTest)97 MaterializedRow (io.prestosql.testing.MaterializedRow)95 OperatorAssertion.toMaterializedResult (io.prestosql.operator.OperatorAssertion.toMaterializedResult)74 RowPagesBuilder (io.prestosql.RowPagesBuilder)63 PlanNodeId (io.prestosql.spi.plan.PlanNodeId)63 Type (io.prestosql.spi.type.Type)61 MarkerPage (io.prestosql.spi.snapshot.MarkerPage)58 Session (io.prestosql.Session)52 ConnectorSession (io.prestosql.spi.connector.ConnectorSession)46 TestingConnectorSession (io.prestosql.testing.TestingConnectorSession)44 ConnectorTableHandle (io.prestosql.spi.connector.ConnectorTableHandle)42 ColumnHandle (io.prestosql.spi.connector.ColumnHandle)38 ConnectorMetadata (io.prestosql.spi.connector.ConnectorMetadata)38 TestingTaskContext (io.prestosql.testing.TestingTaskContext)38 ImmutableList (com.google.common.collect.ImmutableList)34 HiveColumnHandle.bucketColumnHandle (io.prestosql.plugin.hive.HiveColumnHandle.bucketColumnHandle)34 List (java.util.List)32