Skip to content

feat(go): add ARRAY column type support#93

Merged
lidavidm merged 9 commits into
adbc-drivers:mainfrom
rishav394:feat/array-support
Jun 24, 2026
Merged

feat(go): add ARRAY column type support#93
lidavidm merged 9 commits into
adbc-drivers:mainfrom
rishav394:feat/array-support

Conversation

@rishav394

@rishav394 rishav394 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

What's Changed

Add native ARRAY column support by detecting trino-go-client's NullSlice* scan types in ConvertRawColumnType and mapping them to Arrow list types.

  • NullSliceString -> list<utf8>, NullSliceInt64 -> list<int64>, etc.
  • Nested arrays up to 3 dimensions via NullSlice2* / NullSlice3* types
  • listInserter handles []interface{} values from Trino's JSON response, delegating to composable child inserters
  • Array integration tests added to the existing TestSelect suite

Depends on adbc-drivers/driverbase-go#178 (adds ScanType field to sqlwrapper.ColumnType).

Closes #94.

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.
@rishav394
rishav394 requested a review from lidavidm as a code owner June 19, 2026 14:00
@rishav394
rishav394 force-pushed the feat/array-support branch from 3f6ef16 to 97d7ef0 Compare June 19, 2026 17:06
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 lidavidm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread go/array_test.go Outdated
@@ -0,0 +1,188 @@
// Copyright (c) 2025 ADBC Drivers Contributors

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's now well into 2026 :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha. Removed the test completely.

Comment thread go/trino.go Outdated
Comment on lines +164 to +166
func (m *trinoTypeConverter) scanTypeToListType(t reflect.Type) arrow.DataType {
return scanTypeToListMap[t]
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this? Just directly index the map.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was just to cover tests. Removed, used the map directly

Comment thread go/array_test.go Outdated
}
}

func TestScanTypeToListType(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test effectively just hardcodes the map in a second place.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed array_test.go completely. TestSelect covers the functionality end to end

Comment thread go/trino_test.go
Comment thread go/array_test.go Outdated
assert.True(t, arr.IsNull(1))
}

func TestCreateInserter_ListType(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure these tests are actually useful?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

- 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
@rishav394
rishav394 requested a review from lidavidm June 22, 2026 05:17
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.
Comment thread go/trino_test.go
Replace Go integration tests with validation suite query files.
Add SupportsGetTableSchema to satisfy updated validation interface.
@rishav394
rishav394 requested a review from lidavidm June 22, 2026 10:37

@lidavidm lidavidm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't go.mod also need updating?

@rishav394

Copy link
Copy Markdown
Contributor Author

Doesn't go.mod also need updating?

Yes pushed. I have a question regarding that. Should I only update github.com/adbc-drivers/driverbase-go/sqlwrapper's version since the related change is in sqlwrapper only. I have updated all driverbase-go modules for now.

@rishav394
rishav394 requested a review from lidavidm June 23, 2026 14:39

@lidavidm lidavidm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@lidavidm
lidavidm merged commit d613e4b into adbc-drivers:main Jun 24, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ARRAY columns returned as arrow.opaque instead of Arrow List type

2 participants