zeroshade commented on PR #14026: URL: https://github.com/apache/arrow/pull/14026#issuecomment-1239880081
@tschaub I figured out the issue. If you look at the original versions, we ensured that the capacity was `h.Cap/(nbytes)` and Len was `h.Len/(nbytes)` In your implementation here you're only using the length. This is specifically relevant because of how concatenation handles offset types like variable length binary, where we gather the buffers sized to the *length* of the Array, but then expand it by one to ensure it encompasses the final offset. Essentially instead of this: ```go return unsafe.Slice((*int32)(unsafe.Pointer(h.Data)), len(b)/Int32SizeBytes) ``` Do this: ```go return unsafe.Slice((*int32)(unsafe.Pointer(h.Data)), cap(b)/Int32SizeBytes)[:len(b)/Int32SizeBytes] ``` Note the usage of `cap` and the slice of it at the end. -- 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]
