ajantha-bhat commented on code in PR #12647: URL: https://github.com/apache/iceberg/pull/12647#discussion_r2015710527
########## spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/source/SparkScan.java: ########## @@ -195,8 +196,10 @@ protected Statistics estimateStatistics(Snapshot snapshot) { if (readConf.reportColumnStats() && cboEnabled) { colStatsMap = Maps.newHashMap(); List<StatisticsFile> files = table.statisticsFiles(); - if (!files.isEmpty()) { - List<BlobMetadata> metadataList = (files.get(0)).blobMetadata(); + Optional<StatisticsFile> file = + files.stream().filter(f -> f.snapshotId() == snapshot.snapshotId()).findFirst(); Review Comment: As per java implementation, it is always a single stats file per snapshot id. https://github.com/apache/iceberg/blob/695374d8bfbd22f4347cfe43b54a93c41b88f166/core/src/main/java/org/apache/iceberg/TableMetadata.java#L1369 I followed similar design while working on partition stats too. -- 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