gaborkaszab commented on code in PR #14996:
URL: https://github.com/apache/iceberg/pull/14996#discussion_r2685359940
##########
core/src/test/java/org/apache/iceberg/PartitionStatsHandlerTestBase.java:
##########
@@ -182,13 +182,29 @@ public void testAllDatatypePartitionWriting() throws
Exception {
PartitionStatistics partitionStats = randomStats(partitionData);
List<PartitionStatistics> expected =
Collections.singletonList(partitionStats);
- PartitionStatisticsFile statisticsFile =
- PartitionStatsHandler.writePartitionStatsFile(testTable, 42L,
dataSchema, expected);
- List<PartitionStats> written;
- try (CloseableIterable<PartitionStats> recordIterator =
- PartitionStatsHandler.readPartitionStatsFile(
- dataSchema, testTable.io().newInputFile(statisticsFile.path()))) {
+ // Add a dummy file to the table to have a snapshot
+ DataFile dataFile =
+ DataFiles.builder(spec)
+ .withPath("some_path")
+ .withPartition(partitionData)
+ .withFileSizeInBytes(15)
+ .withFormat(FileFormat.PARQUET)
+ .withRecordCount(1)
+ .build();
+ testTable.newAppend().appendFile(dataFile).commit();
+ long snapshotId = testTable.currentSnapshot().snapshotId();
Review Comment:
The old and the new way of reading partition stats have different inputs:
The old function accepts a stat file, while the new one accepts a snapshot ID.
With this some tests using the old way "cheated" a bit while they created a
stat file, and didn't register it with a snapshot to the table, simply passed
the file to the read function.
With the new API we can't do this "cheat" because we query by snapshot ID,
hence you need a snapshot in the table, so that you can register the stat file
with that snapshot.
--
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]