lirui-apache opened a new issue, #13155: URL: https://github.com/apache/iceberg/issues/13155
### Apache Iceberg version main (development) ### Query engine None ### Please describe the bug 🐞 It seems stats diff is computed only from the current snapshot, which may not track deleted files. For example the following test case would fail: ```java @Test public void test() throws Exception { Table testTable = TestTables.create(tempDir("my_test"), "my_test", SCHEMA, SPEC, 2, fileFormatProperty); DataFile dataFile1 = DataFiles.builder(SPEC) .withPath("/df1.parquet") .withPartitionPath("c2=a/c3=a") .withFileSizeInBytes(10) .withRecordCount(1) .build(); DataFile dataFile2 = DataFiles.builder(SPEC) .withPath("/df2.parquet") .withPartitionPath("c2=b/c3=b") .withFileSizeInBytes(10) .withRecordCount(1) .build(); testTable.newAppend().appendFile(dataFile1).appendFile(dataFile2).commit(); testTable .updatePartitionStatistics() .setPartitionStatistics(PartitionStatsHandler.computeAndWriteStatsFile(testTable)) .commit(); testTable.newDelete().deleteFile(dataFile1).commit(); testTable.newDelete().deleteFile(dataFile2).commit(); PartitionStatisticsFile statsFile = PartitionStatsHandler.computeAndWriteStatsFile(testTable); assertThat( PartitionStatsHandler.readPartitionStatsFile( PartitionStatsHandler.schema(Partitioning.partitionType(testTable)), Files.localInput(statsFile.path()))) .allMatch(s -> s.dataRecordCount() == 0); } ``` ### Willingness to contribute - [ ] I can contribute a fix for this bug independently - [ ] I would be willing to contribute a fix for this bug with guidance from the Iceberg community - [ ] I cannot contribute a fix for this bug at this time -- 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.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