Search in sources :

Example 46 with QueryResult

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

the class TestInsert method testInsertNull.

@Test(groups = { SQL_SERVER, PROFILE_SPECIFIC_TESTS })
public void testInsertNull() {
    String sql = format("INSERT INTO %s.%s values (null, null, null, null, null, null, null, null)", SQLSERVER, INSERT_TABLE_NAME);
    onTrino().executeQuery(sql);
    sql = format("SELECT * FROM %s.%s", MASTER, INSERT_TABLE_NAME);
    QueryResult queryResult = onSqlServer().executeQuery(sql);
    assertThat(queryResult).contains(row(null, null, null, null, null, null, null, null));
}
Also used : QueryResult(io.trino.tempto.query.QueryResult) ProductTest(io.trino.tempto.ProductTest) Test(org.testng.annotations.Test)

Example 47 with QueryResult

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

the class TestInsert method testInsertMax.

@Test(groups = { SQL_SERVER, PROFILE_SPECIFIC_TESTS })
public void testInsertMax() {
    String sql = format("INSERT INTO %s.%s values (BIGINT '%s', SMALLINT '%s', INTEGER '%s', DOUBLE '%s', " + "CHAR 'aaaa', 'aaaaaa', DOUBLE '%s', DATE '%s' )", SQLSERVER, INSERT_TABLE_NAME, Long.MAX_VALUE, Short.MAX_VALUE, Integer.MAX_VALUE, Double.MAX_VALUE, Double.valueOf("12345678912.3456756"), Date.valueOf("9999-12-31"));
    onTrino().executeQuery(sql);
    sql = format("SELECT * FROM %s.%s", MASTER, INSERT_TABLE_NAME);
    QueryResult queryResult = onSqlServer().executeQuery(sql);
    assertThat(queryResult).contains(row(Long.MAX_VALUE, Short.MAX_VALUE, Integer.MAX_VALUE, Double.MAX_VALUE, "aaaa", "aaaaaa", Double.valueOf("12345678912.3456756"), Date.valueOf("9999-12-31")));
}
Also used : QueryResult(io.trino.tempto.query.QueryResult) ProductTest(io.trino.tempto.ProductTest) Test(org.testng.annotations.Test)

Example 48 with QueryResult

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

the class TestSelect method testSelectNation.

@Test(groups = { SQL_SERVER, PROFILE_SPECIFIC_TESTS })
public void testSelectNation() {
    QueryResult queryResult = onTrino().executeQuery("SELECT n_nationkey, n_name, n_regionkey, n_comment FROM " + NATION_TABLE_NAME);
    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 49 with QueryResult

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

the class TestSelect method testCreateTableAsSelect.

@Test(groups = { SQL_SERVER, PROFILE_SPECIFIC_TESTS })
public void testCreateTableAsSelect() {
    onTrino().executeQuery(format("CREATE TABLE %s AS SELECT * FROM %s", CREATE_TABLE_AS_SELECT, NATION_TABLE_NAME));
    QueryResult queryResult = onSqlServer().executeQuery(format("SELECT n_nationkey, n_name, n_regionkey, n_comment FROM %s.%s.%s", "master", KEY_SPACE, CTAS_TABLE_NAME));
    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 50 with QueryResult

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

the class TestSelect method testNationJoinRegion.

@Test(groups = { SQL_SERVER, PROFILE_SPECIFIC_TESTS })
public void testNationJoinRegion() {
    String sql = format("SELECT c.n_name, t.name FROM %s c JOIN " + "tpch.tiny.region t ON c.n_regionkey = t.regionkey " + "WHERE c.n_nationkey=3", NATION_TABLE_NAME);
    QueryResult queryResult = onTrino().executeQuery(sql);
    assertThat(queryResult).containsOnly(row("CANADA", "AMERICA"));
}
Also used : QueryResult(io.trino.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.trino.tempto.ProductTest)

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