rdblue commented on code in PR #6090: URL: https://github.com/apache/iceberg/pull/6090#discussion_r1101922436
########## core/src/test/java/org/apache/iceberg/TestRemoveSnapshots.java: ########## @@ -1515,4 +1599,47 @@ private RemoveSnapshots removeSnapshots(Table table) { RemoveSnapshots removeSnapshots = (RemoveSnapshots) table.expireSnapshots(); return (RemoveSnapshots) removeSnapshots.withIncrementalCleanup(incrementalCleanup); } + + private StatisticsFile writeStatsFile( + long snapshotId, long snapshotSequenceNumber, String statsLocation, FileIO fileIO) + throws IOException { + try (PuffinWriter puffinWriter = Puffin.write(fileIO.newOutputFile(statsLocation)).build()) { + puffinWriter.add( + new Blob( + "some-blob-type", + ImmutableList.of(1), + snapshotId, + snapshotSequenceNumber, + ByteBuffer.wrap("blob content".getBytes(StandardCharsets.UTF_8)))); + puffinWriter.finish(); + + return new GenericStatisticsFile( + snapshotId, + statsLocation, + puffinWriter.fileSize(), + puffinWriter.footerSize(), + puffinWriter.writtenBlobsMetadata().stream() + .map(GenericBlobMetadata::from) + .collect(ImmutableList.toImmutableList())); + } + } + + private StatisticsFile reuseStatsForCurrentSnapshot( Review Comment: This is not for the "current" snapshot because the snapshot ID is being passed in. When there are problems that need to be fixed in multiple places, I might just mention it once to avoid unnecessary repetition. So to keep PRs moving faster, you should always look for similar cases that also need to be fixed. -- 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