use of io.trino.testing.MaterializedRow in project trino by trinodb.
the class BaseRaptorConnectorTest method testShardUuidHiddenColumn.
@Test
public void testShardUuidHiddenColumn() {
assertUpdate("CREATE TABLE test_shard_uuid AS SELECT orderdate, orderkey FROM orders", "SELECT count(*) FROM orders");
MaterializedResult actualResults = computeActual("SELECT *, \"$shard_uuid\" FROM test_shard_uuid");
assertEquals(actualResults.getTypes(), ImmutableList.of(DATE, BIGINT, SHARD_UUID_COLUMN_TYPE));
UUID arbitraryUuid = null;
for (MaterializedRow row : actualResults.getMaterializedRows()) {
Object uuid = row.getField(2);
assertInstanceOf(uuid, String.class);
arbitraryUuid = UUID.fromString((String) uuid);
}
assertNotNull(arbitraryUuid);
actualResults = computeActual(format("SELECT * FROM test_shard_uuid where \"$shard_uuid\" = '%s'", arbitraryUuid));
assertNotEquals(actualResults.getMaterializedRows().size(), 0);
actualResults = computeActual("SELECT * FROM test_shard_uuid where \"$shard_uuid\" = 'foo'");
assertEquals(actualResults.getMaterializedRows().size(), 0);
}
use of io.trino.testing.MaterializedRow in project trino by trinodb.
the class TestSingleStoreConnectorTest method testSingleStoreTinyint.
@Test
public void testSingleStoreTinyint() {
onRemoteDatabase().execute("CREATE TABLE tpch.mysql_test_tinyint1 (c_tinyint tinyint(1))");
MaterializedResult actual = computeActual("SHOW COLUMNS FROM mysql_test_tinyint1");
MaterializedResult expected = resultBuilder(getSession(), VARCHAR, VARCHAR, VARCHAR, VARCHAR).row("c_tinyint", "tinyint", "", "").build();
assertEquals(actual, expected);
onRemoteDatabase().execute("INSERT INTO tpch.mysql_test_tinyint1 VALUES (127), (-128)");
MaterializedResult materializedRows = computeActual("SELECT * FROM tpch.mysql_test_tinyint1 WHERE c_tinyint = 127");
assertEquals(materializedRows.getRowCount(), 1);
MaterializedRow row = getOnlyElement(materializedRows);
assertEquals(row.getFields().size(), 1);
assertEquals(row.getField(0), (byte) 127);
assertUpdate("DROP TABLE mysql_test_tinyint1");
}
Aggregations