aokolnychyi commented on code in PR #9284: URL: https://github.com/apache/iceberg/pull/9284#discussion_r1432488248
########## core/src/main/java/org/apache/iceberg/ReachableFileUtil.java: ########## @@ -148,12 +148,49 @@ public static List<String> statisticsFilesLocations(Table table) { * @param table table for which statistics files needs to be listed * @param predicate predicate for filtering the statistics files * @return the location of statistics files + * @deprecated use the {@code statisticsFilesLocationsForSnapshots(table, snapshotIds)} instead. */ + @Deprecated public static List<String> statisticsFilesLocations( Table table, Predicate<StatisticsFile> predicate) { return table.statisticsFiles().stream() .filter(predicate) .map(StatisticsFile::path) .collect(Collectors.toList()); } + + /** + * Returns locations of all statistics files for a table matching the given snapshot IDs. + * + * @param table table for which statistics files needs to be listed + * @param snapshotIds ids of snapshots for which statistics files will be returned. If null, + * statistics files for all the snapshots will be returned. + * @return the location of statistics files + */ + public static List<String> statisticsFilesLocationsForSnapshots( + Table table, Set<Long> snapshotIds) { + List<String> statsFileLocations = Lists.newArrayList(); + Predicate<StatisticsFile> statsFilePredicate; + Predicate<PartitionStatisticsFile> partitionStatsFilePredicate; + if (snapshotIds == null) { Review Comment: What about the following to shorten the vars and avoid splitting the logic into multiple lines? ``` Predicate<StatisticsFile> statsFilePredicate; Predicate<PartitionStatisticsFile> partitionStatsFilePredicate; if (snapshotIds == null) { statsFilePredicate = file -> true; partitionStatsFilePredicate = file -> true; } else { statsFilePredicate = file -> snapshotIds.contains(file.snapshotId()); partitionStatsFilePredicate = file -> snapshotIds.contains(file.snapshotId()); } ``` -- 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