-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
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
-
Unsupported by default
In(*stmt).NextColumnType, encountering a column withtype.kind == “user_defined”will causeNextColumnType(or downstream type mapping) to return an error:return nil, fmt.Errorf("unsupported column type: %s", tc.String())
trino-java-client
- Base64 encoder default
Inio.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(). - 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
-
In the column-type detection logic (e.g. in
ColumnConverterForType), detecttype.kind == user_definedand return a converter that:- Reads the raw payload bytes
- Calls
encoding/base64.StdEncoding.EncodeToString([]bytePayload) - Returns the resulting
stringto the caller
-
nineinchnick
Metadata
Metadata
Assignees
Labels
No labels