stevenzwu commented on code in PR #13425:
URL: https://github.com/apache/iceberg/pull/13425#discussion_r2180806265


##########
core/src/main/java/org/apache/iceberg/PartitionStatsHandler.java:
##########
@@ -115,6 +123,49 @@ public static Schema schema(StructType 
unifiedPartitionType) {
         LAST_UPDATED_SNAPSHOT_ID);
   }
 
+  /**
+   * Generates the partition stats file schema for a given format version 
based on a combined
+   * partition type which considers all specs in a table.
+   *
+   * @param unifiedPartitionType unified partition schema type. Could be 
calculated by {@link
+   *     Partitioning#partitionType(Table)}.
+   * @return a schema that corresponds to the provided unified partition type.
+   */
+  public static Schema schema(StructType unifiedPartitionType, int 
formatVersion) {
+    Preconditions.checkState(!unifiedPartitionType.fields().isEmpty(), "Table 
must be partitioned");
+
+    if (formatVersion <= 2) {
+      return schema(unifiedPartitionType);
+    }
+
+    return new Schema(

Review Comment:
   nit: maybe move this to a separate method like `Schema v3Schema()`. In the 
future, the old `schema()` method could be renamed to `v2Schema()`.



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