RussellSpitzer commented on code in PR #18459:
URL: https://github.com/apache/iceberg/pull/18459#discussion_r4255816189
##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkScan.java:
##########
@@ -214,19 +215,26 @@ protected Statistics estimateStatistics(Snapshot
snapshot) {
Map<Integer, List<BlobMetadata>> groupedByField =
metadataList.stream()
+ .filter(metadata -> !metadata.fields().isEmpty())
.collect(
Collectors.groupingBy(
metadata -> metadata.fields().get(0),
Collectors.toList()));
for (Map.Entry<Integer, List<BlobMetadata>> entry :
groupedByField.entrySet()) {
String colName = table.schema().findColumnName(entry.getKey());
+ if (colName == null) {
Review Comment:
This looks incorrect to me, we are checking the statistics file schema
against the current table schema instead of the schema of the snapshot which
produced the stats file.
Instead we should be using `SnapshotUtil.schemaFor(table,
snapshot.snapshotId())` This would fix the issue (since we should only fail if
the Snapshot's schema doesn't match the stats file we recorded for it.)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]