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"));
}
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));
}
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));
}
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"));
}
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");
}
}
Aggregations