Summary
Today the two official Trino clients diverge in how they handle User-Defined Types (UDTs):
- trino-java-client
Defaults to serializing UDT values via a Base64 encoder, allowing arbitrary binary payloads to round-trip without error.
- trino-go-client
Treats any UDT as an unsupported type and immediately raises an exception when encountering one.
This mismatch causes cross-language interoperability issues and surprises Go users who expect the same “just works” behavior as in Java. We should align the Go client’s behavior to match the Java client: default to Base64-encoding UDT values, and only error if encoding itself fails.
Current Behavior
trino-go-client
trino-java-client
- Base64 encoder default
In io.trino.client.StatementClient, UDT payloads are represented as opaque byte[] values, which the client maps to Base64 strings in JSON. When rows are fetched, those JSON Base64 values are decoded into Java’s byte[] and can be consumed via ResultSet.getBytes().
- No error path
Unless the Base64 itself is malformed, the Java client will never raise a “unsupported type” error for UDT columns.
Proposal
-
Add a Base64 default converter for UDT columns in trino-go-client
Summary
Today the two official Trino clients diverge in how they handle User-Defined Types (UDTs):
Defaults to serializing UDT values via a Base64 encoder, allowing arbitrary binary payloads to round-trip without error.
Treats any UDT as an unsupported type and immediately raises an exception when encountering one.
This mismatch causes cross-language interoperability issues and surprises Go users who expect the same “just works” behavior as in Java. We should align the Go client’s behavior to match the Java client: default to Base64-encoding UDT values, and only error if encoding itself fails.
Current Behavior
trino-go-client
Unsupported by default
In
(*stmt).NextColumnType, encountering a column withtype.kind == “user_defined”will causeNextColumnType(or downstream type mapping) to return an error:trino-java-client
In
io.trino.client.StatementClient, UDT payloads are represented as opaquebyte[]values, which the client maps to Base64 strings in JSON. When rows are fetched, those JSON Base64 values are decoded into Java’sbyte[]and can be consumed viaResultSet.getBytes().Unless the Base64 itself is malformed, the Java client will never raise a “unsupported type” error for UDT columns.
Proposal
Add a Base64 default converter for UDT columns in trino-go-client
In the column-type detection logic (e.g. in
ColumnConverterForType), detecttype.kind == user_definedand return a converter that:encoding/base64.StdEncoding.EncodeToString([]bytePayload)stringto the caller