feat(go): add ARRAY column type support#93
Conversation
Detect ARRAY columns by checking ScanType against trino-go-client's
NullSlice* types in ConvertRawColumnType. Maps to Arrow list types
(list<utf8>, list<int64>, etc.) with support for nested arrays up
to 3 dimensions.
Adds listInserter that handles []interface{} values from the Trino
JSON response, delegating element insertion to composable child
inserters.
Depends on driverbase-go ScanType field addition.
3f6ef16 to
97d7ef0
Compare
Unit tests (array_test.go): scanTypeToListType mapping, ConvertRawColumnType with ARRAY ScanTypes, listInserter with string/int arrays and null handling, CreateInserter ListType case. Integration tests (trino_test.go): TestSelectArray verifies full ADBC pipeline against live Trino for ARRAY(VARCHAR), ARRAY(INTEGER), nested ARRAY(ARRAY(INTEGER)), and null arrays.
lidavidm
left a comment
There was a problem hiding this comment.
If this only tackles ARRAY, let's file a sub-issue instead of linking this to the original issue which lists other types as well.
| @@ -0,0 +1,188 @@ | |||
| // Copyright (c) 2025 ADBC Drivers Contributors | |||
There was a problem hiding this comment.
it's now well into 2026 :)
There was a problem hiding this comment.
Haha. Removed the test completely.
| func (m *trinoTypeConverter) scanTypeToListType(t reflect.Type) arrow.DataType { | ||
| return scanTypeToListMap[t] | ||
| } |
There was a problem hiding this comment.
Why do we need this? Just directly index the map.
There was a problem hiding this comment.
Was just to cover tests. Removed, used the map directly
| } | ||
| } | ||
|
|
||
| func TestScanTypeToListType(t *testing.T) { |
There was a problem hiding this comment.
This test effectively just hardcodes the map in a second place.
There was a problem hiding this comment.
Removed array_test.go completely. TestSelect covers the functionality end to end
| assert.True(t, arr.IsNull(1)) | ||
| } | ||
|
|
||
| func TestCreateInserter_ListType(t *testing.T) { |
There was a problem hiding this comment.
I'm not sure these tests are actually useful?
- Remove scanTypeToListType wrapper, index scanTypeToListMap directly - Delete array_test.go, coverage moved to TestSelect integration cases - Merge TestSelectArray cases into TestSelect - Fix copyright year to 2026
Add arr_col to test_types table, replace 4 inline array cases with 1 table-backed case covering data and nulls.
Tests data, null, and empty array in one case.
Replace Go integration tests with validation suite query files. Add SupportsGetTableSchema to satisfy updated validation interface.
lidavidm
left a comment
There was a problem hiding this comment.
Doesn't go.mod also need updating?
Yes pushed. I have a question regarding that. Should I only update |
What's Changed
Add native ARRAY column support by detecting trino-go-client's
NullSlice*scan types inConvertRawColumnTypeand mapping them to Arrow list types.NullSliceString->list<utf8>,NullSliceInt64->list<int64>, etc.NullSlice2*/NullSlice3*typeslistInserterhandles[]interface{}values from Trino's JSON response, delegating to composable child insertersTestSelectsuiteDepends on adbc-drivers/driverbase-go#178 (adds
ScanTypefield tosqlwrapper.ColumnType).Closes #94.