deniskuzZ commented on code in PR #13329: URL: https://github.com/apache/iceberg/pull/13329#discussion_r2154222042
########## core/src/main/java/org/apache/iceberg/PartitionStatsHandler.java: ########## @@ -263,30 +249,12 @@ private static OutputFile newPartitionStatsFile( private static PartitionStats recordToPartitionStats(StructLike record) { PartitionStats stats = new PartitionStats( - record.get(PARTITION_POSITION, StructLike.class), - record.get(SPEC_ID_POSITION, Integer.class)); - stats.set(DATA_RECORD_COUNT_POSITION, record.get(DATA_RECORD_COUNT_POSITION, Long.class)); - stats.set(DATA_FILE_COUNT_POSITION, record.get(DATA_FILE_COUNT_POSITION, Integer.class)); - stats.set( - TOTAL_DATA_FILE_SIZE_IN_BYTES_POSITION, - record.get(TOTAL_DATA_FILE_SIZE_IN_BYTES_POSITION, Long.class)); - stats.set( - POSITION_DELETE_RECORD_COUNT_POSITION, - record.get(POSITION_DELETE_RECORD_COUNT_POSITION, Long.class)); - stats.set( - POSITION_DELETE_FILE_COUNT_POSITION, - record.get(POSITION_DELETE_FILE_COUNT_POSITION, Integer.class)); - stats.set( - EQUALITY_DELETE_RECORD_COUNT_POSITION, - record.get(EQUALITY_DELETE_RECORD_COUNT_POSITION, Long.class)); - stats.set( - EQUALITY_DELETE_FILE_COUNT_POSITION, - record.get(EQUALITY_DELETE_FILE_COUNT_POSITION, Integer.class)); - stats.set(TOTAL_RECORD_COUNT_POSITION, record.get(TOTAL_RECORD_COUNT_POSITION, Long.class)); - stats.set(LAST_UPDATED_AT_POSITION, record.get(LAST_UPDATED_AT_POSITION, Long.class)); - stats.set( - LAST_UPDATED_SNAPSHOT_ID_POSITION, - record.get(LAST_UPDATED_SNAPSHOT_ID_POSITION, Long.class)); + record.get(0, StructLike.class), // partition Review Comment: Using raw numbers directly in code is considered bad practice. Static analysis tools flag them as magic numbers and recommend replacing them with named constants. This enhances code readability and makes maintenance easier. ```` int i = 0; PartitionStats stats = new PartitionStats( record.get(i++, StructLike.class), record.get(i++, Integer.class) ); for (; i < record.size(); i++) { stats.set(i, record.get(i, Object.class)); } ```` -- 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