use of io.trino.tempto.Requires in project trino by trinodb.
the class TestAllDatatypesFromHiveConnector method testSelectAllDatatypesTextFile.
@Requires(TextRequirements.class)
@Test(groups = SMOKE)
public void testSelectAllDatatypesTextFile() {
String tableName = ALL_HIVE_SIMPLE_TYPES_TEXTFILE.getName();
assertProperAllDatatypesSchema(tableName);
QueryResult queryResult = onTrino().executeQuery(format("SELECT * FROM %s", tableName));
assertColumnTypes(queryResult);
assertThat(queryResult).containsOnly(row(127, 32767, 2147483647, 9223372036854775807L, 123.345f, 234.567, new BigDecimal("346"), new BigDecimal("345.67800"), Timestamp.valueOf(LocalDateTime.of(2015, 5, 10, 12, 15, 35, 123_000_000)), Date.valueOf("2015-05-10"), "ala ma kota", "ala ma kot", "ala ma ", true, "kot binarny".getBytes(UTF_8)));
}
use of io.trino.tempto.Requires in project trino by trinodb.
the class TestJdbc method shouldInsertSelectQuery.
@Test(groups = JDBC)
@Requires(ImmutableAndMutableNationTable.class)
public void shouldInsertSelectQuery() throws SQLException {
String tableNameInDatabase = mutableTablesState().get(TABLE_NAME).getNameInDatabase();
assertThat(onTrino().executeQuery("SELECT * FROM " + tableNameInDatabase)).hasNoRows();
try (Statement statement = connection().createStatement()) {
assertThat(statement.executeUpdate("insert into " + tableNameInDatabase + " select * from nation")).isEqualTo(25);
}
assertThat(onTrino().executeQuery("SELECT * FROM " + tableNameInDatabase)).matches(PRESTO_NATION_RESULT);
}
use of io.trino.tempto.Requires in project trino by trinodb.
the class TestJdbc method shouldExecuteQueryWithSelectedCatalogAndSchema.
@Test(groups = JDBC)
@Requires(ImmutableNationTable.class)
public void shouldExecuteQueryWithSelectedCatalogAndSchema() throws SQLException {
connection().setCatalog("hive");
connection().setSchema("default");
try (Statement statement = connection().createStatement()) {
QueryResult result = queryResult(statement, "select * from nation");
assertThat(result).matches(PRESTO_NATION_RESULT);
}
}
use of io.trino.tempto.Requires in project trino by trinodb.
the class TestJdbc method shouldGetTables.
@Test(groups = JDBC)
@Requires(ImmutableNationTable.class)
public void shouldGetTables() throws SQLException {
QueryResult result = QueryResult.forResultSet(metaData().getTables("hive", null, null, null));
assertThat(result).contains(row("hive", "default", "nation", "TABLE", null, null, null, null, null, null));
}
use of io.trino.tempto.Requires in project trino by trinodb.
the class TestJdbc method shouldExecuteQuery.
@Test(groups = JDBC)
@Requires(ImmutableNationTable.class)
public void shouldExecuteQuery() throws SQLException {
try (Statement statement = connection().createStatement()) {
QueryResult result = queryResult(statement, "select * from hive.default.nation");
assertThat(result).matches(PRESTO_NATION_RESULT);
}
}
Aggregations