fallintoplace commented on PR #1080: URL: https://github.com/apache/arrow-go/pull/1080#issuecomment-5195734175
That is the intended usage, but the API currently does not enforce or document that ownership constraint. NewMetadata retains the caller-provided []byte, and Bytes() also exposes it directly, while Clone() is documented as creating a deep copy. For metadata parsed by NewMetadata, the key slices point into the original input buffer. Reusing or overwriting that input after cloning can therefore change KeyAt and IdFor on the clone even though the clone’s serialized data was copied. The normal path in this change does not copy the key payloads a second time. It keeps the existing bytes.Clone(m.data) and rebuilds the key slices to point into that cloned buffer. I can update the test to mutate the original input slice rather than calling metadata.Bytes() so the ownership case is clearer. @zeroshade -- 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]
