ajantha-bhat commented on code in PR #13329:
URL: https://github.com/apache/iceberg/pull/13329#discussion_r2151925151


##########
core/src/main/java/org/apache/iceberg/PartitionStatsHandler.java:
##########
@@ -65,29 +65,44 @@ private PartitionStatsHandler() {}
 
   private static final Logger LOG = 
LoggerFactory.getLogger(PartitionStatsHandler.class);
 
-  public static final int PARTITION_FIELD_ID = 0;
+  // schema of the partition stats file as per spec
+  public static final int PARTITION_FIELD_ID = 1;
   public static final String PARTITION_FIELD_NAME = "partition";
-  public static final NestedField SPEC_ID = NestedField.required(1, "spec_id", 
IntegerType.get());
+  public static final NestedField SPEC_ID = NestedField.required(2, "spec_id", 
IntegerType.get());
   public static final NestedField DATA_RECORD_COUNT =
-      NestedField.required(2, "data_record_count", LongType.get());
+      NestedField.required(3, "data_record_count", LongType.get());
   public static final NestedField DATA_FILE_COUNT =
-      NestedField.required(3, "data_file_count", IntegerType.get());
+      NestedField.required(4, "data_file_count", IntegerType.get());
   public static final NestedField TOTAL_DATA_FILE_SIZE_IN_BYTES =
-      NestedField.required(4, "total_data_file_size_in_bytes", LongType.get());
+      NestedField.required(5, "total_data_file_size_in_bytes", LongType.get());
   public static final NestedField POSITION_DELETE_RECORD_COUNT =
-      NestedField.optional(5, "position_delete_record_count", LongType.get());
+      NestedField.optional(6, "position_delete_record_count", LongType.get());
   public static final NestedField POSITION_DELETE_FILE_COUNT =
-      NestedField.optional(6, "position_delete_file_count", IntegerType.get());
+      NestedField.optional(7, "position_delete_file_count", IntegerType.get());
   public static final NestedField EQUALITY_DELETE_RECORD_COUNT =
-      NestedField.optional(7, "equality_delete_record_count", LongType.get());
+      NestedField.optional(8, "equality_delete_record_count", LongType.get());
   public static final NestedField EQUALITY_DELETE_FILE_COUNT =
-      NestedField.optional(8, "equality_delete_file_count", IntegerType.get());
+      NestedField.optional(9, "equality_delete_file_count", IntegerType.get());
   public static final NestedField TOTAL_RECORD_COUNT =
-      NestedField.optional(9, "total_record_count", LongType.get());
+      NestedField.optional(10, "total_record_count", LongType.get());
   public static final NestedField LAST_UPDATED_AT =
-      NestedField.optional(10, "last_updated_at", LongType.get());
+      NestedField.optional(11, "last_updated_at", LongType.get());
   public static final NestedField LAST_UPDATED_SNAPSHOT_ID =
-      NestedField.optional(11, "last_updated_snapshot_id", LongType.get());
+      NestedField.optional(12, "last_updated_snapshot_id", LongType.get());
+
+  // position in StructLike
+  static final int PARTITION_POSITION = 0;
+  static final int SPEC_ID_POSITION = 1;
+  static final int DATA_RECORD_COUNT_POSITION = 2;
+  static final int DATA_FILE_COUNT_POSITION = 3;
+  static final int TOTAL_DATA_FILE_SIZE_IN_BYTES_POSITION = 4;
+  static final int POSITION_DELETE_RECORD_COUNT_POSITION = 5;
+  static final int POSITION_DELETE_FILE_COUNT_POSITION = 6;
+  static final int EQUALITY_DELETE_RECORD_COUNT_POSITION = 7;
+  static final int EQUALITY_DELETE_FILE_COUNT_POSITION = 8;
+  static final int TOTAL_RECORD_COUNT_POSITION = 9;
+  static final int LAST_UPDATED_AT_POSITION = 10;
+  static final int LAST_UPDATED_SNAPSHOT_ID_POSITION = 11;

Review Comment:
   are you suggesting to use the hardcoded value like 0,1,2 instead? 



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

Reply via email to