dkranchii opened a new pull request, #17934:
URL: https://github.com/apache/iceberg/pull/17934
## Summary
- Resolve the existing TODO in `VariantTestUtil.createArray` by introducing
a shared `sizeInBytes(VariantValue)` helper that derives serialized byte size
from the physical type instead of calling `VariantValue.sizeInBytes()` directly.
- Apply the same helper to `VariantTestUtil.createObject`, so both container
builders compute sizes consistently and remain correct for nested or
non-buffer-backed values.
- The helper returns `buffer().remaining()` for pre-serialized values,
computes primitives from their `PhysicalType` (with special handling for
`STRING`/`BINARY`), recurses into arrays, and delegates to
`VariantValue.sizeInBytes()` only for non-serialized `OBJECT` (whose field-id
size requires the object's own metadata).
Closes #17510.
## Test plan
- New `TestVariantTestUtil` covers the helper for serialized primitives,
short strings, long strings, flat and nested serialized arrays, and asserts
that the computed size equals the number of bytes actually written by `writeTo`.
- Existing `TestSerializedArray` and `TestSerializedObject` continue to
exercise `createArray`/`createObject` end-to-end.
- Local checks:
- [ ] `./gradlew spotlessCheck`
- [ ] `./gradlew :iceberg-api:test`
---
**AI Disclosure**
- Platform/Tool: Cursor
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]