use of io.trino.plugin.hive.HiveTimestampPrecision in project trino by trinodb.
the class TestHiveStorageFormats method assertSimpleTimestamps.
/**
* Assertions for tables created by {@link #createSimpleTimestampTable(String, StorageFormat)}
*/
private static void assertSimpleTimestamps(String tableName, List<TimestampAndPrecision> data) {
SoftAssertions softly = new SoftAssertions();
for (TimestampAndPrecision entry : data) {
for (HiveTimestampPrecision precision : HiveTimestampPrecision.values()) {
setTimestampPrecision(precision);
// Assert also with `CAST AS varchar` on the server side to avoid any JDBC-related issues
softly.check(() -> assertThat(onTrino().executeQuery(format("SELECT id, typeof(ts), CAST(ts AS varchar), ts FROM %s WHERE id = %s", tableName, entry.getId()))).as("timestamp(%d)", precision.getPrecision()).containsOnly(row(entry.getId(), entry.getReadType(precision), entry.getReadValue(precision), Timestamp.valueOf(entry.getReadValue(precision)))));
}
}
softly.assertAll();
}
Aggregations