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 @@ -548,7 +548,8 @@ private void createMetadataWithBase(
addedFiles,
modifiedPartitions,
baseDataManifestFileMetas,
snapshotId);
snapshotId,
snapshot.commitKind());
newDataManifestFileMetas = result.getLeft();
snapshotSummary = result.getRight();
}
Expand Down Expand Up @@ -778,7 +779,8 @@ private List<IcebergManifestFileMeta> createNewlyAddedManifestFileMetas(
Map<String, Pair<BinaryRow, DataFileMeta>> addedFiles,
List<BinaryRow> modifiedPartitions,
List<IcebergManifestFileMeta> baseManifestFileMetas,
long currentSnapshotId)
long currentSnapshotId,
Snapshot.CommitKind commitKind)
throws IOException {
IcebergSnapshotSummary snapshotSummary = IcebergSnapshotSummary.APPEND;
List<IcebergManifestFileMeta> newManifestFileMetas = new ArrayList<>();
Expand Down Expand Up @@ -833,7 +835,10 @@ private List<IcebergManifestFileMeta> createNewlyAddedManifestFileMetas(
newManifestFileMetas.add(fileMeta);
} else {
// some file is removed, rewrite this file meta
snapshotSummary = IcebergSnapshotSummary.OVERWRITE;
snapshotSummary =
commitKind == Snapshot.CommitKind.COMPACT
? IcebergSnapshotSummary.REPLACE
: IcebergSnapshotSummary.OVERWRITE;
List<IcebergManifestEntry> newEntries = new ArrayList<>();
for (IcebergManifestEntry entry : entries) {
if (entry.isLive()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class IcebergSnapshotSummary {

public static final IcebergSnapshotSummary APPEND = new IcebergSnapshotSummary("append");
public static final IcebergSnapshotSummary OVERWRITE = new IcebergSnapshotSummary("overwrite");
public static final IcebergSnapshotSummary REPLACE = new IcebergSnapshotSummary("replace");

private final Map<String, String> summary;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ private void testDeleteImpl(boolean deletionVector) throws Exception {
// In dv mode, full compaction will remove all dv index and rewrite data files
assertThat(getIcebergResult()).containsExactlyInAnyOrder("Record(2, 21)");

FileIO fileIO = table.fileIO();
long latestSnapshotId = table.snapshotManager().latestSnapshotId();
IcebergMetadata metadata =
IcebergMetadata.fromPath(
fileIO,
new Path(
table.location(),
"metadata/v" + latestSnapshotId + ".metadata.json"));
assertThat(metadata.currentSnapshot().summary().operation()).isEqualTo("replace");

write.close();
commit.close();
}
Expand Down