Search in sources :

Example 21 with QueryResult

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

the class TestSelect method testSelectWithFilterOnPartitioningKey.

@Test(groups = { CASSANDRA, PROFILE_SPECIFIC_TESTS })
public void testSelectWithFilterOnPartitioningKey() {
    String sql = format("SELECT n_nationkey FROM %s.%s.%s WHERE n_nationkey > 23", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_NATION.getName());
    QueryResult queryResult = onTrino().executeQuery(sql);
    assertThat(queryResult).containsOnly(row(24));
}
Also used : QueryResult(io.trino.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.trino.tempto.ProductTest)

Example 22 with QueryResult

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

the class TestSelect method testSelectWithMorePartitioningKeysThanLimitNonPK.

@Test(groups = { CASSANDRA, PROFILE_SPECIFIC_TESTS })
public void testSelectWithMorePartitioningKeysThanLimitNonPK() {
    String sql = format("SELECT s_suppkey FROM %s.%s.%s WHERE s_name = 'Supplier#000000010'", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_SUPPLIER.getName());
    QueryResult queryResult = onTrino().executeQuery(sql);
    assertThat(queryResult).containsOnly(row(10));
}
Also used : QueryResult(io.trino.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.trino.tempto.ProductTest)

Example 23 with QueryResult

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

the class TestSelect method testSelectNation.

@Test(groups = { CASSANDRA, PROFILE_SPECIFIC_TESTS })
public void testSelectNation() {
    String sql = format("SELECT n_nationkey, n_name, n_regionkey, n_comment FROM %s.%s.%s", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_NATION.getName());
    QueryResult queryResult = onTrino().executeQuery(sql);
    assertThat(queryResult).matches(PRESTO_NATION_RESULT);
}
Also used : QueryResult(io.trino.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.trino.tempto.ProductTest)

Example 24 with QueryResult

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

the class TestSelectMultiColumnKey method testSelectWithMixedFilterOnPrimaryAndClusteringKeys.

@Test(groups = { CASSANDRA, PROFILE_SPECIFIC_TESTS })
public void testSelectWithMixedFilterOnPrimaryAndClusteringKeys() {
    String sql = format("SELECT value FROM %s.%s.%s WHERE user_id = 'Alice' and key < 'b' 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 25 with QueryResult

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

the class TestSelectMultiColumnKey method testSelectWithFilterOnPrefixOfClusteringKey.

@Test(groups = { CASSANDRA, PROFILE_SPECIFIC_TESTS })
public void testSelectWithFilterOnPrefixOfClusteringKey() {
    String sql = format("SELECT value FROM %s.%s.%s WHERE user_id = 'Bob' and key = 'b1'", CONNECTOR_NAME, KEY_SPACE, CASSANDRA_MULTI_COLUMN_KEY.getName());
    QueryResult queryResult = onTrino().executeQuery(sql);
    assertThat(queryResult).containsOnly(row("Test value 2"));
}
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