huan233usc opened a new pull request, #16607:
URL: https://github.com/apache/iceberg/pull/16607

   ## Summary
   
   Hook `GeospatialBound` into `Conversions.toByteBuffer` / `fromByteBuffer` so 
that v3 single-value binary serialization for `geometry` and `geography` 
actually round-trips through Iceberg's central type conversion API.
   
   The encoding itself is already implemented in `GeospatialBound` per the 
[Bound Serialization](https://iceberg.apache.org/spec/#bound-serialization) 
section of the spec (Appendix D): an x:y:z:m concatenation of 8-byte 
little-endian IEEE 754 doubles, with x:y when both z and m are unset, x:y:z 
when only m is unset, and x:y:NaN:m when only z is unset.
   
   Today `Conversions.toByteBuffer(GeometryType, ...)` and 
`fromByteBuffer(GeometryType, ...)` fall through to the `default` case and 
throw `UnsupportedOperationException`, so any caller that goes through 
`Conversions` (manifest writers/readers, `ContentFileParser`, metric helpers, 
etc.) cannot handle geo lower/upper bounds. This PR adds the missing cases. It 
is purely additive — no behavior changes for non-geo types and no downstream 
code is silently activated, since the file readers/writers and evaluators still 
need their own follow-ups.
   
   ## Test plan
   
   - [x] New `testByteBufferConversionsForGeometry` covers `geometry` and 
`geography` × {XY (16B), XYZ (24B), XYM (32B with NaN-Z slot), XYZM (32B)} 
round-trips with explicit byte layouts, plus a non-default CRS to confirm the 
encoding is CRS-independent.
   - [x] New `testNullByteBufferConversionsForGeometry` covers null in both 
directions for both types.
   - [x] `./gradlew :iceberg-api:test --tests "org.apache.iceberg.types.*" 
--tests "org.apache.iceberg.geospatial.*"` — all green, no regressions in 
`TestGeospatialBound` / `TestBoundingBox`.
   - [x] `./gradlew :iceberg-api:checkstyleMain :iceberg-api:checkstyleTest 
:iceberg-api:spotlessCheck` — clean.


-- 
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]

Reply via email to