nssalian opened a new pull request, #939:
URL: https://github.com/apache/arrow-go/pull/939
### Rationale for this change
A variant bound is stored on disk as the variant metadata bytes concatenated
with
the value bytes (metadata ++ value), as Iceberg does for variant
`lower_bound` /
`upper_bound`. `Metadata.Bytes()` returns the backing slice as-is, so a
caller that
reads such a concatenated buffer has no way to know where the metadata ends
and the
value begins. `NewMetadata` accepts a buffer with trailing bytes but does
not expose
the metadata's own length.
iceberg-go needs this to read variant bounds back for scan pruning
(apache/iceberg-go#1016): it must split a stored bound into metadata and
value to
reconstruct the variant. Filing it now so it is released ahead of that work.
### What changes are included in this PR?
- Adds `Metadata.SizeBytes()`, which computes the metadata's own byte length
from its
header and offset table (the final offset gives the string-region length
past
`valuesStart`). A caller can then split a buffer at `data[m.SizeBytes():]`.
### Are these changes tested?
Yes. `TestMetadataSizeBytes` covers empty metadata, a keyed object, and
splitting a
concatenated metadata++value buffer with a round-trip through `New`.
`TestMetadataSizeBytesMultiByteOffset` covers the multi-byte offset-width
path.
### Are there any user-facing changes?
One new exported method. No change to existing behavior.
--
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]