Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ public RewriteManifests addManifest(ManifestFile manifest) {
Preconditions.checkArgument(
manifest.snapshotId() == null || manifest.snapshotId() == -1,
"Snapshot id must be assigned during commit");
Preconditions.checkArgument(manifest.sequenceNumber() == -1,
"Sequence must be assigned during commit");

if (snapshotIdInheritanceEnabled && manifest.snapshotId() == null) {
addedManifests.add(manifest);
Expand Down Expand Up @@ -174,7 +176,6 @@ public List<ManifestFile> apply(TableMetadata base) {

validateFilesCounts();

// TODO: add sequence numbers here
Iterable<ManifestFile> newManifestsWithMetadata = Iterables.transform(
Iterables.concat(newManifests, addedManifests, rewrittenAddedManifests),
manifest -> GenericManifestFile.copyOf(manifest).withSnapshotId(snapshotId()).build());
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/org/apache/iceberg/FastAppend.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public FastAppend appendManifest(ManifestFile manifest) {
Preconditions.checkArgument(
manifest.snapshotId() == null || manifest.snapshotId() == -1,
"Snapshot id must be assigned during commit");
Preconditions.checkArgument(manifest.sequenceNumber() == -1,
"Sequence number must be assigned during commit");

if (snapshotIdInheritanceEnabled && manifest.snapshotId() == null) {
summaryBuilder.addedManifest(manifest);
Expand Down Expand Up @@ -131,7 +133,6 @@ public List<ManifestFile> apply(TableMetadata base) {
throw new RuntimeIOException(e, "Failed to write manifest");
}

// TODO: add sequence numbers here
Iterable<ManifestFile> appendManifestsWithMetadata = Iterables.transform(
Iterables.concat(appendManifests, rewrittenAppendManifests),
manifest -> GenericManifestFile.copyOf(manifest).withSnapshotId(snapshotId()).build());
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/org/apache/iceberg/MergeAppend.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public AppendFiles appendManifest(ManifestFile manifest) {
Preconditions.checkArgument(
manifest.snapshotId() == null || manifest.snapshotId() == -1,
"Snapshot id must be assigned during commit");
Preconditions.checkArgument(manifest.sequenceNumber() == -1,
"Sequence must be assigned during commit");
add(manifest);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ public List<ManifestFile> apply(TableMetadata base) {
newManifests = Iterables.concat(appendManifests, rewrittenAppendManifests);
}

// TODO: add sequence numbers here
Iterable<ManifestFile> newManifestsWithMetadata = Iterables.transform(
newManifests,
manifest -> GenericManifestFile.copyOf(manifest).withSnapshotId(snapshotId()).build());
Expand Down Expand Up @@ -676,11 +675,11 @@ private ManifestFile createManifest(int specId, List<ManifestFile> bin) throws I
// suppress deletes from previous snapshots. only files deleted by this snapshot
// should be added to the new manifest
if (entry.snapshotId() == snapshotId()) {
writer.addEntry(entry);
writer.delete(entry);
}
} else if (entry.status() == Status.ADDED && entry.snapshotId() == snapshotId()) {
// adds from this snapshot are still adds, otherwise they should be existing
writer.addEntry(entry);
writer.add(entry);
} else {
// add all files from the old manifest as existing files
writer.existing(entry);
Expand Down
Loading