stevenzwu commented on code in PR #18394:
URL: https://github.com/apache/iceberg/pull/18394#discussion_r4352950764
##########
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:
great catch!
`select("content_stats.geom.lower_bound.m")` doesn't seem like a useful
scenario. Geo bounds should always be read in full. But I agree that we should
restore the full geo bound at read.
The full bound is restored in the read schema, before projection, by adding
the projected lower_bound / upper_bound field ids to the RestoreColumns set in
idsToRestore. I also added test coverage as suggested.
--
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]