rdblue commented on a change in pull request #2984: URL: https://github.com/apache/iceberg/pull/2984#discussion_r689853861
########## File path: core/src/main/java/org/apache/iceberg/util/PartitionUtil.java ########## @@ -51,6 +53,20 @@ private PartitionUtil() { MetadataColumns.FILE_PATH.fieldId(), convertConstant.apply(Types.StringType.get(), task.file().path())); + // add _spec + idToConstant.put( + MetadataColumns.SPEC.fieldId(), + convertConstant.apply(Types.IntegerType.get(), task.file().specId())); + + // add _partition + if (partitionType.fields().isEmpty()) { + // use null as some query engines may not be able to handle empty structs + idToConstant.put(MetadataColumns.PARTITION_COLUMN_ID, null); + } else { + StructLike partition = Partitioning.reconcilePartition(partitionType, spec, partitionData); + idToConstant.put(MetadataColumns.PARTITION_COLUMN_ID, convertConstant.apply(partitionType, partition)); Review comment: Is `partitionType` derived from the read schema? It would be nice to be able to project fields and avoid bringing along extra data. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org