nastra commented on code in PR #12464: URL: https://github.com/apache/iceberg/pull/12464#discussion_r1983223453
########## data/src/main/java/org/apache/iceberg/data/PartitionStatsHandler.java: ########## @@ -121,37 +119,35 @@ public static Schema schema(StructType unifiedPartitionType) { * present. */ public static PartitionStatisticsFile computeAndWriteStatsFile(Table table) throws IOException { - return computeAndWriteStatsFile(table, SnapshotRef.MAIN_BRANCH); + if (table.currentSnapshot() == null) { + return null; + } + + return computeAndWriteStatsFile(table, table.currentSnapshot().snapshotId()); } /** - * Computes and writes the {@link PartitionStatisticsFile} for a given table and branch. + * Computes and writes the {@link PartitionStatisticsFile} for a given table and snapshot. * * @param table The {@link Table} for which the partition statistics is computed. - * @param branch A branch information to select the required snapshot. - * @return {@link PartitionStatisticsFile} for the given branch, or null if no statistics are + * @param snapshotId snapshot for which partition statistics is computed. Review Comment: ```suggestion * @param snapshotId snapshot for which partition statistics are computed. ``` -- 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