use of io.trino.tempto.query.QueryResult in project trino by trinodb.
the class TestRoles method testListRoles.
@Test(groups = { ROLES, AUTHORIZATION, PROFILE_SPECIFIC_TESTS })
public void testListRoles() {
onTrino().executeQuery(format("CREATE ROLE %s IN hive", ROLE1));
QueryResult expected = onHive().executeQuery("SHOW ROLES");
QueryResult actual = onTrino().executeQuery("SELECT * FROM hive.information_schema.roles");
assertThat(actual.rows()).containsOnly(expected.rows().toArray(new List[] {}));
}
use of io.trino.tempto.query.QueryResult in project trino by trinodb.
the class TestSyncPartitionMetadata method assertPartitions.
private static void assertPartitions(String tableName, QueryAssert.Row... rows) {
QueryResult partitionListResult = onTrino().executeQuery("SELECT * FROM \"" + tableName + "$partitions\" ORDER BY 1, 2");
assertThat(partitionListResult).containsExactlyInOrder(rows);
}
use of io.trino.tempto.query.QueryResult in project trino by trinodb.
the class TestSyncPartitionMetadata method assertData.
private static void assertData(String tableName, QueryAssert.Row... rows) {
QueryResult dataResult = onTrino().executeQuery("SELECT payload, col_x, col_y FROM " + tableName + " ORDER BY 1, 2, 3 ASC");
assertThat(dataResult).containsExactlyInOrder(rows);
}
use of io.trino.tempto.query.QueryResult in project trino by trinodb.
the class TestTablePartitioningSelect method testSelectPartitionedHiveTableDifferentFormats.
@Test
public void testSelectPartitionedHiveTableDifferentFormats() {
String tableNameInDatabase = tablesState.get(TABLE_NAME).getNameInDatabase();
String selectFromOnePartitionsSql = "SELECT * FROM " + tableNameInDatabase + " WHERE part_col = 2";
QueryResult onePartitionQueryResult = onTrino().executeQuery(selectFromOnePartitionsSql);
assertThat(onePartitionQueryResult).containsOnly(row(42, 2));
try {
// This query should fail or return null values for invalid partition data
assertThat(onTrino().executeQuery("SELECT * FROM " + tableNameInDatabase)).containsOnly(row(42, 2), row(null, 1));
} catch (QueryExecutionException expectedDueToInvalidPartitionData) {
}
}
use of io.trino.tempto.query.QueryResult in project trino by trinodb.
the class TestKafkaAvroReadsSmokeTest method testNullType.
@Test(groups = { KAFKA, PROFILE_SPECIFIC_TESTS }, dataProvider = "catalogs")
public void testNullType(KafkaCatalog kafkaCatalog, MessageSerializer messageSerializer) throws Exception {
String topicName = ALL_NULL_AVRO_TOPIC_NAME + kafkaCatalog.getTopicNameSuffix();
createAvroTable(ALL_DATATYPE_SCHEMA_PATH, ALL_NULL_AVRO_TOPIC_NAME, topicName, ImmutableMap.of(), messageSerializer);
assertEventually(new Duration(30, SECONDS), () -> {
QueryResult queryResult = onTrino().executeQuery(format("select * from %s.%s", kafkaCatalog.getCatalogName(), KAFKA_SCHEMA + "." + topicName));
assertThat(queryResult).containsOnly(row(null, null, null, null));
});
}
Aggregations