szehon-ho commented on code in PR #18394:
URL: https://github.com/apache/iceberg/pull/18394#discussion_r4343444449


##########
core/src/main/java/org/apache/iceberg/V4ManifestReader.java:
##########
@@ -247,6 +249,22 @@ private CloseableIterable<TrackedFile> open() {
     return reader;
   }
 
+  private static void registerCustomBoundTypes(
+      InternalData.ReadBuilder readBuilder, Types.NestedField fieldStats) {
+    Types.StructType struct = fieldStats.type().asStructType();
+    registerGeoBoundType(readBuilder, 
struct.field(StatsUtil.LOWER_BOUND_NAME));
+    registerGeoBoundType(readBuilder, 
struct.field(StatsUtil.UPPER_BOUND_NAME));
+  }
+
+  private static void registerGeoBoundType(
+      InternalData.ReadBuilder readBuilder, Types.NestedField boundField) {
+    // Geometry and geography are the only bound types represented as structs, 
so a struct bound
+    // is read as GeospatialBound.
+    if (boundField != null && boundField.type().isStructType()) {
+      readBuilder.setCustomType(boundField.fieldId(), GeospatialBound.class);

Review Comment:
   Please restore the full geo bound before registering this custom type. No 
current callers select individual geo coordinates, but the package-private 
builder API accepts `select("content_stats.geom.lower_bound.m")`. With no 
filter requiring full stats, the bound schema contains only `m`, so both Avro 
and Parquet call `GeospatialBound.set(0, value)` and treat M as X. For an XY 
bound, null M throws `Invalid x coordinate: null`. Restoring X/Y/Z/M for 
selected geo bounds would preserve coordinate positions. Please add regression 
coverage for both formats.



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