Search in sources :

Example 41 with QueryResult

use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.

the class TestSyncPartitionMetadata method assertPartitions.

private static void assertPartitions(String tableName, QueryAssert.Row... rows) {
    QueryResult partitionListResult = query("SELECT * FROM \"" + tableName + "$partitions\" ORDER BY 1, 2");
    assertThat(partitionListResult).containsExactly(rows);
}
Also used : QueryResult(io.prestodb.tempto.query.QueryResult)

Example 42 with QueryResult

use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.

the class KafkaSmokeTest method testSelectSimpleKeyAndValue.

@Test(groups = { KAFKA })
@Requires(SimpleKeyAndValueTable.class)
public void testSelectSimpleKeyAndValue() {
    QueryResult queryResult = query(format("select varchar_key, bigint_key, varchar_value, bigint_value from %s.%s.%s", KAFKA_CATALOG, SCHEMA_NAME, SIMPLE_KEY_AND_VALUE_TABLE_NAME));
    assertThat(queryResult).containsOnly(row("jasio", 1, "ania", 2), row("piotr", 3, "kasia", 4));
}
Also used : QueryResult(io.prestodb.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.prestodb.tempto.ProductTest) Requires(io.prestodb.tempto.Requires)

Example 43 with QueryResult

use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.

the class TestInsert method testInsertMin.

@Test(groups = { SQL_SERVER, PROFILE_SPECIFIC_TESTS })
public void testInsertMin() {
    String sql = format("INSERT INTO %s.%s values (BIGINT '%s', SMALLINT '%s', INTEGER '%s', DOUBLE '%s', " + "CHAR 'a   ', 'aa', DOUBLE '%s', DATE '%s')", SQLSERVER, INSERT_TABLE_NAME, Long.valueOf("-9223372036854775807"), Short.MIN_VALUE, Integer.MIN_VALUE, Double.MIN_VALUE, Double.MIN_VALUE, Date.valueOf("1970-01-01"));
    // Min value for BIGINT would be updated to "-9223372036854775808" post https://github.com/prestodb/presto/issues/4571
    onPresto().executeQuery(sql);
    sql = format("SELECT * FROM %s.%s", MASTER, INSERT_TABLE_NAME);
    QueryResult queryResult = onSqlServer().executeQuery(sql);
    assertThat(queryResult).contains(row(Long.valueOf("-9223372036854775807"), Short.MIN_VALUE, Integer.MIN_VALUE, Double.MIN_VALUE, "a   ", "aa", Double.MIN_VALUE, Date.valueOf("1970-01-01")));
}
Also used : QueryResult(io.prestodb.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.prestodb.tempto.ProductTest)

Example 44 with QueryResult

use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.

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);
    onPresto().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.prestodb.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.prestodb.tempto.ProductTest)

Example 45 with QueryResult

use of io.prestodb.tempto.query.QueryResult in project urban-eureka by errir503.

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"));
    onPresto().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.prestodb.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.prestodb.tempto.ProductTest)

Aggregations

QueryResult (io.prestodb.tempto.query.QueryResult)122 Test (org.testng.annotations.Test)110 ProductTest (io.prestodb.tempto.ProductTest)108 Requires (io.prestodb.tempto.Requires)38 BigDecimal (java.math.BigDecimal)14 Statement (java.sql.Statement)12 PreparedStatement (java.sql.PreparedStatement)8 Duration (io.airlift.units.Duration)6 Row (io.prestodb.tempto.assertions.QueryAssert.Row)6 List (java.util.List)6 STORAGE_FORMATS (com.facebook.presto.tests.TestGroups.STORAGE_FORMATS)4 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)4 Row.row (io.prestodb.tempto.assertions.QueryAssert.Row.row)4 QueryAssert.assertThat (io.prestodb.tempto.assertions.QueryAssert.assertThat)4 QueryExecutor.query (io.prestodb.tempto.query.QueryExecutor.query)4 String.format (java.lang.String.format)4 Connection (java.sql.Connection)4 Response (com.facebook.airlift.http.client.Response)2 PrestoConnection (com.facebook.presto.jdbc.PrestoConnection)2 JdbcDriverUtils (com.facebook.presto.tests.utils.JdbcDriverUtils)2