nastra commented on code in PR #17433:
URL: https://github.com/apache/iceberg/pull/17433#discussion_r3689292949
##########
core/src/main/java/org/apache/iceberg/V4ManifestReader.java:
##########
@@ -122,16 +128,27 @@ private CloseableIterable<TrackedFile> open() {
Preconditions.checkArgument(
format != null, "Cannot determine format of manifest: %s",
file.location());
- CloseableIterable<TrackedFile> reader =
+ InternalData.ReadBuilder readBuilder =
InternalData.read(format, file)
.project(readSchema)
.setRootType(TrackedFileStruct.class)
.setCustomType(TrackedFile.TRACKING.fieldId(),
TrackingStruct.class)
.setCustomType(TrackedFile.DELETION_VECTOR.fieldId(),
DeletionVectorStruct.class)
.setCustomType(TrackedFile.MANIFEST_INFO.fieldId(),
ManifestInfoStruct.class)
.setCustomType(TrackedFile.PARTITION_ID, PartitionData.class)
- .reuseContainers()
- .build();
+ .reuseContainers();
+
+ // content_stats is missing when it is not projected and unknown when no
stats are read
+ Types.NestedField statsField =
readSchema.findField(TrackedFile.CONTENT_STATS_ID);
+ if (statsField != null && statsField.type().isStructType()) {
+ readBuilder.setCustomType(TrackedFile.CONTENT_STATS_ID,
ContentStatsStruct.class);
+ // content_stats holds one stats struct per projected column
+ for (Types.NestedField fieldStats :
statsField.type().asStructType().fields()) {
+ readBuilder.setCustomType(fieldStats.fieldId(),
FieldStatsStruct.class);
Review Comment:
good point, I've added tests for geo + variant types with single/multiple
files and this uncovered a bug around Geo types copying, which I've fixed in
`FieldStatsStruct`
--
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]