Data types and result conversion - Amazon Athena
Services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the AWS European Sovereign Cloud Region, see the AWS European Sovereign Cloud User Guide.

Data types and result conversion

JDBC 4.x selects an engine-specific type system. The following table gives the declared JDBC type and default Java class for DuckDB result columns; typed getters can request conversions supported by the driver.

The following table describes DuckDB result type mappings.

DuckDB typejava.sql.Types valueDefault Java class
BOOLEANBOOLEANBoolean
TINYINTTINYINTByte
UTINYINT / SMALLINTSMALLINTShort
USMALLINT / INTEGERINTEGERInteger
UINTEGER / BIGINTBIGINTLong
UBIGINT / HUGEINT / UHUGEINT / BIGNUMOTHERBigInteger
FLOAT / DOUBLEFLOAT / DOUBLEFloat / Double
DECIMALDECIMALBigDecimal
VARCHAR / BITVARCHARString
BLOB / GEOMETRYVARBINARYbyte[]
UUIDOTHERString
DATEDATEjava.sql.Date
TIME / TIME_NSTIMEjava.sql.Time
TIME WITH TIME ZONETIME_WITH_TIMEZONEjava.sql.Time
TIMESTAMP / TIMESTAMP_S / TIMESTAMP_MS / TIMESTAMP_NSTIMESTAMPjava.sql.Timestamp
TIMESTAMP WITH TIME ZONETIMESTAMP_WITH_TIMEZONEjava.sql.Timestamp
LIST / ARRAYARRAYjava.sql.Array
INTERVAL / JSON / VARIANT / STRUCT / TUPLE / MAP / UNION / ENUMOTHERString

Read extended values

Read large unsigned and 128-bit integers as BigInteger rather than narrowing them to long. The driver declares UBIGINT, HUGEINT, and UHUGEINT as Types.OTHER with a BigInteger Java class.

Use getArray for list and array results. Array.getArray() returns a String[], and the array base type is VARCHAR. Struct, map, union, interval, and variant values have string-valued default mappings.

For geometry results that use the Arrow geoarrow.wkb extension, getBytes returns the stored well-known binary bytes and getString renders well-known text. On string-result paths, getBytes converts geometry well-known text to well-known binary and decodes DuckDB BLOB text to bytes.

ResultSetMetaData.getColumnType() reports the JDBC type selected by the driver, and getColumnClassName() reports its declared Java class.