hcrosse opened a new pull request, #1602: URL: https://github.com/apache/arrow-go/pull/1602
### Rationale for this change Arrow Go lacks `list_view` and `large_list_view` scalars. `MakeNullScalar` panics, `GetScalar` errors on valid slots and panics on nulls, and `list_element` rejects list view results. I reproduced this on v18.9.0, with Go 1.26.10 on macOS arm64. ```go scalar.MakeNullScalar(arrow.ListViewOf(arrow.PrimitiveTypes.Int32)) ``` ```text panic: runtime error: invalid memory address or nil pointer dereference ``` ### What changes are included in this PR? `MakeNullScalar`, `GetScalar`, `MakeScalarParam`, `Append`, `MakeArrayFromScalar` and `ArraySpan.FillFromScalar` support both types. `WithType` constructors preserve the element field. `MakeArrayFromScalar` uses the C++ layout, with offset 0 and the value's length as the size of every row. C++ shares the value, and Go copies it once. https://github.com/apache/arrow/blob/976779b2aac587f51b87c3bd2e6ae4c36f75ab6c/cpp/src/arrow/array/util.cc#L686-L701 `Validate` rejects a `list_view` value with more than `math.MaxInt32` elements, and `FillFromScalar` panics on one because it cannot return an error. The `list_element` scalar result guard and its tests are removed. The dense union offset check stays, because an invalid dense union scalar would otherwise panic in the take kernel. ### Are these changes tested? `TestListViewScalars`, `TestListViewScalarEqualsAndCastTo`, `TestListViewScalarSizeLimit`, `TestListElementListViewScalarInput`, `TestListElementScalarListWithListViewElement`, `TestListElementNullScalarListViewElement`, `TestArraySpan_FillFromScalarListViewOverwritesScratch` and `TestArraySpan_FillFromScalarListViewSizeLimit` fail with only the new types and constructors added, and pass with this change. I ran `go test -count=1 -race ./arrow/...` and `golangci-lint` 2.13.2 on linux/amd64. Both passed. Vet, race tests and lint for `arrow/scalar`, `arrow/compute`, `arrow/compute/exec` and `arrow/array` also passed on macOS arm64. ### Are there any user-facing changes? Yes. List views support scalar operations. New `scalar` APIs are `ListView`, `LargeListView`, `NewListViewScalar`, `NewLargeListViewScalar`, `NewListViewScalarData`, `NewLargeListViewScalarData`, `NewListViewScalarWithType` and `NewLargeListViewScalarWithType`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
