fix(athena): report a HUGEINT result column as bigint (#8254)

This commit is contained in:
Ghassan Gedeon Achi authored and GitHub committed 2026-11-13 23:05:50 -04:00
1 parent ea4427ca58
commit 8185a340c4
3 files changed
+21 -2

No files matched your search

@@ -41,4 +41,19 @@ class AthenaColumnTypesSidecarIntegrationTest {
assertEquals(List.of("bigint", "double", "boolean", "date", "decimal", "varchar", "time", "timestamp",
"timestamp with time zone"), types);
}
/**
* Trino returns BIGINT for {@code count_if} and for {@code sum} over a BIGINT; DuckDB widens both
* to HUGEINT, which Athena clients must still see as bigint.
*/
@Test
void aggregatesDuckDbWidensToHugeintAreReportedAsBigint() {
List<String> duckTypes = duck.query("DESCRIBE SELECT count_if(true) AS c, sum(CAST(1 AS BIGINT)) AS s", null)
.stream()
.map(column -> String.valueOf(column.get("column_type")))
.toList();
assertEquals(List.of("HUGEINT", "HUGEINT"), duckTypes);
assertEquals(List.of("bigint", "bigint"), duckTypes.stream().map(AthenaService::athenaType).toList());
}
}