hcrosse opened a new issue, #1523: URL: https://github.com/apache/arrow-go/issues/1523
### Describe the bug, including details regarding any error messages, version, and platform. `cdata.ExportArrowArray` exports extension arrays with missing storage buffers, children or dictionaries. Importing the result can fail, produce an invalid array or lose dictionary values. I reproduced the view, struct and list cases on v18.8.0 and main, with Go 1.26.10 on macOS arm64. **Reproduction** For list storage: ```go dt := arrow.ListOf(arrow.PrimitiveTypes.Int32) storage, _, _ := array.FromJSON(memory.DefaultAllocator, dt, strings.NewReader(`[[1, 2], null, []]`)) arr := array.NewExtensionArrayWithStorage(extensions.NewOpaqueType(dt, "t", "v"), storage) var ca cdata.CArrowArray var cs cdata.CArrowSchema cdata.ExportArrowArray(arr, &ca, &cs) _, got, err := cdata.ImportCArray(&ca, &cs) ``` Actual output: ```text ext<list<item: int32, nullable>>: expected 1 children, for imported type list<item: int32, nullable>, ArrowArray has 0 ``` Expected output: ```text ext<list<item: int32, nullable>>: <nil> ``` **Cause** `exportArray` chooses the buffer layout using the extension type ID rather than the storage type ID. Its array type switch also misses the storage children and dictionary. https://github.com/apache/arrow-go/blob/be922ec557c08b06d9f8243023b08e192eaeaa1d/arrow/cdata/cdata_exports.go#L345-L363 https://github.com/apache/arrow-go/blob/be922ec557c08b06d9f8243023b08e192eaeaa1d/arrow/cdata/cdata_exports.go#L403-L437 The schema exporter unwraps the extension to obtain the format but switches on the original type, losing dictionary schemas. https://github.com/apache/arrow-go/blob/be922ec557c08b06d9f8243023b08e192eaeaa1d/arrow/cdata/cdata_exports.go#L289-L305 I have a patch with tests and can open a PR. ### Component(s) Other -- 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]
