Search in sources :

Example 56 with QueryResult

use of io.trino.tempto.query.QueryResult in project trino by trinodb.

the class TestSelect method testProtocolVersion.

@Test(groups = { CASSANDRA, PROFILE_SPECIFIC_TESTS })
public void testProtocolVersion() {
    QueryResult queryResult = onTrino().executeQuery(format("SELECT native_protocol_version FROM %s.system.local", CONNECTOR_NAME));
    assertThat(queryResult).containsOnly(row("4"));
}
Also used : QueryResult(io.trino.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.trino.tempto.ProductTest)

Example 57 with QueryResult

use of io.trino.tempto.query.QueryResult in project trino by trinodb.

the class TestSelect method testNationJoinNation.

@Test(groups = { CASSANDRA, PROFILE_SPECIFIC_TESTS })
public void testNationJoinNation() {
    String tableName = format("%s.%s.%s", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_NATION.getName());
    String sql = format("SELECT n1.n_name, n2.n_regionkey FROM %s n1 JOIN " + "%s n2 ON n1.n_nationkey = n2.n_regionkey " + "WHERE n1.n_nationkey=3", tableName, tableName);
    QueryResult queryResult = onTrino().executeQuery(sql);
    assertThat(queryResult).containsOnly(row("CANADA", 3), row("CANADA", 3), row("CANADA", 3), row("CANADA", 3), row("CANADA", 3));
}
Also used : QueryResult(io.trino.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.trino.tempto.ProductTest)

Example 58 with QueryResult

use of io.trino.tempto.query.QueryResult in project trino by trinodb.

the class TestSelectMultiColumnKey method testSelectWithEqualityFilterOnPrimaryAndClusteringKeys.

@Test(groups = { CASSANDRA, PROFILE_SPECIFIC_TESTS })
public void testSelectWithEqualityFilterOnPrimaryAndClusteringKeys() {
    String sql = format("SELECT value FROM %s.%s.%s WHERE user_id = 'Alice' and key = 'a1' and updated_at = TIMESTAMP '2015-01-01 01:01:01Z'", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_MULTI_COLUMN_KEY.getName());
    QueryResult queryResult = onTrino().executeQuery(sql);
    assertThat(queryResult).containsOnly(row("Test value 1"));
}
Also used : QueryResult(io.trino.tempto.query.QueryResult) ProductTest(io.trino.tempto.ProductTest) Test(org.testng.annotations.Test)

Example 59 with QueryResult

use of io.trino.tempto.query.QueryResult in project trino by trinodb.

the class TestSelectMultiColumnKey method testSelectWithEqualityFilterOnClusteringKey.

@Test(groups = { CASSANDRA, PROFILE_SPECIFIC_TESTS })
public void testSelectWithEqualityFilterOnClusteringKey() {
    String sql = format("SELECT value FROM %s.%s.%s WHERE key = 'a1'", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_MULTI_COLUMN_KEY.getName());
    QueryResult queryResult = onTrino().executeQuery(sql);
    assertThat(queryResult).containsOnly(row("Test value 1"));
}
Also used : QueryResult(io.trino.tempto.query.QueryResult) ProductTest(io.trino.tempto.ProductTest) Test(org.testng.annotations.Test)

Example 60 with QueryResult

use of io.trino.tempto.query.QueryResult in project trino by trinodb.

the class TestClickHouse method testCreateTableAsSelect.

@Test(groups = { CLICKHOUSE, PROFILE_SPECIFIC_TESTS })
public void testCreateTableAsSelect() {
    QueryResult result = onTrino().executeQuery("CREATE TABLE nation AS SELECT * FROM tpch.tiny.nation");
    try {
        assertThat(result).updatedRowsCountIsEqualTo(25);
        assertThat(onTrino().executeQuery("SELECT COUNT(*) FROM nation")).containsOnly(row(25));
    } finally {
        onTrino().executeQuery("DROP TABLE nation");
    }
}
Also used : QueryResult(io.trino.tempto.query.QueryResult) ProductTest(io.trino.tempto.ProductTest) Test(org.testng.annotations.Test)

Aggregations

QueryResult (io.trino.tempto.query.QueryResult)84 Test (org.testng.annotations.Test)75 ProductTest (io.trino.tempto.ProductTest)61 Requires (io.trino.tempto.Requires)16 Row (io.trino.tempto.assertions.QueryAssert.Row)8 BigDecimal (java.math.BigDecimal)8 Duration (io.airlift.units.Duration)7 Flaky (io.trino.testng.services.Flaky)6 Statement (java.sql.Statement)6 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)4 QueryExecutionException (io.trino.tempto.query.QueryExecutionException)4 PreparedStatement (java.sql.PreparedStatement)4 ImmutableList (com.google.common.collect.ImmutableList)3 Row.row (io.trino.tempto.assertions.QueryAssert.Row.row)3 QueryAssert.assertThat (io.trino.tempto.assertions.QueryAssert.assertThat)3 List (java.util.List)3 Inject (com.google.inject.Inject)2 HiveTimestampPrecision (io.trino.plugin.hive.HiveTimestampPrecision)2 HMS_ONLY (io.trino.tests.product.TestGroups.HMS_ONLY)2 STORAGE_FORMATS (io.trino.tests.product.TestGroups.STORAGE_FORMATS)2