stevenzwu commented on code in PR #19030:
URL: https://github.com/apache/iceberg/pull/19030#discussion_r4649223839
##########
core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java:
##########
@@ -1025,6 +1100,43 @@ private void validateDeleteFilesForVersion(int
currentFormatVersion) {
}
}
+ @Override
+ protected NewSnapshotMetadata writeRootManifest(
+ TableMetadata base, Snapshot parent, long sequenceNumber) {
+ validateDeleteFilesForVersion(base.formatVersion());
+
+ if (addsDeleteFiles()) {
+ throw new UnsupportedOperationException("Cannot add new delete files in
v4");
+ } else if (filterManager.containsDeletes()) {
+ throw new UnsupportedOperationException("Cannot remove data files in
v4");
+ } else if (deleteFilterManager.containsDeletes()) {
+ throw new UnsupportedOperationException("Cannot remove delete files in
v4");
+ } else if (!appendManifests.isEmpty()) {
Review Comment:
Should this also check `rewrittenAppendManifests`? For example, a manifest
appended to a v1 table is copied into that list, and if the table is upgraded
to v4 before commit, the copy isn't added to the root and is deleted after
commit, so its files are silently dropped. A test for this case would be good
too.
--
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]