powerman2026 opened a new pull request, #1628: URL: https://github.com/apache/arrow-go/pull/1628
### Rationale for this change A caller cannot release a successful scalar cast uniformly. For example, a binary-to-string cast owns a buffer reference, but a list identity cast borrows one. The difference propagates through run-end encoded casts. A scalar expression batch currently compensates by retaining a valid result, which leaks the reference of the binary-to-string cast. ### What changes are included in this PR? Define successful casts as returning an owned reference and retain the receiver in identity casts of reference-counted lists, list views, extensions, and run-end encoded scalars. The expression batch takes ownership of a successful cast and still retains an input field when no cast was needed. ### Are these changes tested? On main the expression regression leaves 64 bytes in a checked allocator after executing an int32 literal with a binary input field cast to utf8. The three run-end encoded cases also fail because releasing the input frees the list buffers before the result is released. The tests pass with this change, including the UUID extension identity case. I ran the repository tests with both data submodules and ran the scalar and expression packages with the race detector and the assert,test build tags. ### Are there any user-facing changes? Callers of CastTo own the returned scalar and should release it when it implements scalar.Releasable, including when the receiver and result are the same object. Callers that previously treated list or extension identity casts as borrowed need to release the result. Fixes #1563 -- 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]
