diff --git a/spark2/src/main/java/org/apache/iceberg/spark/source/Reader.java b/spark2/src/main/java/org/apache/iceberg/spark/source/Reader.java index edc03c3ef7e5..3631e94acb59 100644 --- a/spark2/src/main/java/org/apache/iceberg/spark/source/Reader.java +++ b/spark2/src/main/java/org/apache/iceberg/spark/source/Reader.java @@ -306,16 +306,15 @@ public Statistics estimateStatistics() { return new Stats(SparkSchemaUtil.estimateSize(lazyType(), totalRecords), totalRecords); } - long sizeInBytes = 0L; long numRows = 0L; for (CombinedScanTask task : tasks()) { for (FileScanTask file : task.files()) { - sizeInBytes += file.length(); numRows += file.file().recordCount(); } } + long sizeInBytes = SparkSchemaUtil.estimateSize(lazyType(), numRows); return new Stats(sizeInBytes, numRows); }