Search in sources :

Example 11 with Requires

use of io.prestodb.tempto.Requires in project presto by prestodb.

the class KafkaAvroSmokeTest method testSelectStructuralDataType.

@Test(groups = { KAFKA })
@Requires(StructuralDataTypeTable.class)
public void testSelectStructuralDataType() throws SQLException {
    QueryResult queryResult = query(format("SELECT a[1], a[2], m['key1'] FROM (SELECT c_array as a, c_map as m FROM %s.%s) t", KAFKA_CATALOG, STRUCTURAL_AVRO_TABLE_NAME));
    assertThat(queryResult).containsOnly(row(100, 102, "value1"));
}
Also used : QueryResult(io.prestodb.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.prestodb.tempto.ProductTest) Requires(io.prestodb.tempto.Requires)

Example 12 with Requires

use of io.prestodb.tempto.Requires in project presto by prestodb.

the class KafkaAvroSmokeTest method testSelectPrimitiveDataType.

@Test(groups = { KAFKA })
@Requires(AllDataTypesAvroTable.class)
public void testSelectPrimitiveDataType() throws SQLException {
    QueryResult queryResult = query(format("select * from %s.%s", KAFKA_CATALOG, ALL_DATATYPES_AVRO_TABLE_NAME));
    assertThat(queryResult).containsOnly(row("foobar", 127, 234.567, true));
}
Also used : QueryResult(io.prestodb.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.prestodb.tempto.ProductTest) Requires(io.prestodb.tempto.Requires)

Example 13 with Requires

use of io.prestodb.tempto.Requires in project presto by prestodb.

the class CreateTableAsSelect method testCreateTableAsSelect.

@Requires(ImmutableNationTable.class)
@Test(groups = { JDBC, MYSQL })
public void testCreateTableAsSelect() {
    QueryResult queryResult = query(format("CREATE TABLE mysql.%s AS SELECT * FROM nation", TABLE_NAME));
    assertThat(queryResult).containsOnly(row(25));
}
Also used : QueryResult(io.prestodb.tempto.query.QueryResult) Requires(io.prestodb.tempto.Requires) Test(org.testng.annotations.Test) ProductTest(io.prestodb.tempto.ProductTest)

Example 14 with Requires

use of io.prestodb.tempto.Requires in project presto by prestodb.

the class JdbcTests method shouldGetTableTypes.

@Test(groups = JDBC)
@Requires(ImmutableNationTable.class)
public void shouldGetTableTypes() throws SQLException {
    QueryResult result = QueryResult.forResultSet(metaData().getTableTypes());
    assertThat(result).contains(row("TABLE"), row("VIEW"));
}
Also used : QueryResult(io.prestodb.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.prestodb.tempto.ProductTest) Requires(io.prestodb.tempto.Requires)

Example 15 with Requires

use of io.prestodb.tempto.Requires in project presto by prestodb.

the class PreparedStatements method preparedInsertVarbinaryApi.

@Test(groups = { JDBC, SIMBA_JDBC })
@Requires(MutableAllTypesTable.class)
public void preparedInsertVarbinaryApi() {
    if (usingTeradataJdbcDriver(connection())) {
        String tableNameInDatabase = mutableTablesState().get(TABLE_NAME_MUTABLE).getNameInDatabase();
        String insertSqlWithTable = String.format(INSERT_SQL, tableNameInDatabase);
        String selectSqlWithTable = String.format(SELECT_STAR_SQL, tableNameInDatabase);
        defaultQueryExecutor().executeQuery(insertSqlWithTable, param(TINYINT, null), param(SMALLINT, null), param(INTEGER, null), param(BIGINT, null), param(FLOAT, null), param(DOUBLE, null), param(DECIMAL, null), param(DECIMAL, null), param(TIMESTAMP, null), param(DATE, null), param(VARCHAR, null), param(VARCHAR, null), param(CHAR, null), param(BOOLEAN, null), param(VARBINARY, new byte[] { 0, 1, 2, 3, 0, 42, -7 }));
        QueryResult result = defaultQueryExecutor().executeQuery(selectSqlWithTable);
        assertColumnTypes(result);
        assertThat(result).containsOnly(row(null, null, null, null, null, null, null, null, null, null, null, null, null, null, new byte[] { 0, 1, 2, 3, 0, 42, -7 }));
    } else {
        LOGGER.warn("preparedInsertVarbinaryApi() only applies to TeradataJdbcDriver");
    }
}
Also used : QueryResult(io.prestodb.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.prestodb.tempto.ProductTest) Requires(io.prestodb.tempto.Requires)

Aggregations

ProductTest (io.prestodb.tempto.ProductTest)21 Requires (io.prestodb.tempto.Requires)21 Test (org.testng.annotations.Test)21 QueryResult (io.prestodb.tempto.query.QueryResult)19 BigDecimal (java.math.BigDecimal)7 Statement (java.sql.Statement)6 PreparedStatement (java.sql.PreparedStatement)3 BigInteger (java.math.BigInteger)1