mirror of
https://github.com/floci-io/floci.git
synced 2026-12-04 02:28:08 -05:00
test(athena): share a types helper in the date-time function tests (#10071)
fromIso8601TimestampIsTypedTimestampWithTimeZone and withTimezoneIsTypedTimestampWithTimeZone repeated the same DESCRIBE query with only the SQL changed. A types(sql) helper next to row(...) now serves both; the assertions are unchanged.
This commit is contained in:
1 parent
f895b21f52
commit
bab25677bb
1 file changed
+9
-14
+9
-14
@@ -36,6 +36,13 @@ class AthenaTrinoDateTimeFunctionsSidecarIntegrationTest {
|
||||
return duck.query(TrinoSqlCompatibility.translate(trinoSql), TrinoSqlCompatibility.FUNCTION_MACROS).getFirst();
|
||||
}
|
||||
|
||||
private List<String> types(String trinoSql) {
|
||||
return duck.query("DESCRIBE " + TrinoSqlCompatibility.translate(trinoSql), TrinoSqlCompatibility.FUNCTION_MACROS)
|
||||
.stream()
|
||||
.map(column -> AthenaService.athenaType(String.valueOf(column.get("column_type"))))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Test
|
||||
void fromIso8601TimestampReadsADateTimeWithAnOffsetAsThatInstant() {
|
||||
Map<String, Object> row = row("SELECT "
|
||||
@@ -128,13 +135,7 @@ class AthenaTrinoDateTimeFunctionsSidecarIntegrationTest {
|
||||
|
||||
@Test
|
||||
void fromIso8601TimestampIsTypedTimestampWithTimeZone() {
|
||||
List<String> types = duck.query("DESCRIBE " + TrinoSqlCompatibility.translate(
|
||||
"SELECT from_iso8601_timestamp('2026-12-02T08:22:50Z') AS t"), TrinoSqlCompatibility.FUNCTION_MACROS)
|
||||
.stream()
|
||||
.map(column -> AthenaService.athenaType(String.valueOf(column.get("column_type"))))
|
||||
.toList();
|
||||
|
||||
assertEquals(List.of("timestamp with time zone"), types);
|
||||
assertEquals(List.of("timestamp with time zone"), types("SELECT from_iso8601_timestamp('2026-12-02T08:22:50Z') AS t"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -151,13 +152,7 @@ class AthenaTrinoDateTimeFunctionsSidecarIntegrationTest {
|
||||
|
||||
@Test
|
||||
void withTimezoneIsTypedTimestampWithTimeZone() {
|
||||
List<String> types = duck.query("DESCRIBE " + TrinoSqlCompatibility.translate(
|
||||
"SELECT with_timezone(TIMESTAMP '2026-12-02 08:22:50', 'UTC') AS t"), TrinoSqlCompatibility.FUNCTION_MACROS)
|
||||
.stream()
|
||||
.map(column -> AthenaService.athenaType(String.valueOf(column.get("column_type"))))
|
||||
.toList();
|
||||
|
||||
assertEquals(List.of("timestamp with time zone"), types);
|
||||
assertEquals(List.of("timestamp with time zone"), types("SELECT with_timezone(TIMESTAMP '2026-12-02 08:22:50', 'UTC') AS t"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user