in amoro-ams/src/main/java/org/apache/amoro/server/dashboard/MixedAndIcebergTableDescriptor.java [346:422]
public List<PartitionFileBaseInfo> getSnapshotDetail(
AmoroTable<?> amoroTable, String snapshotId, @Nullable String ref) {
MixedTable mixedTable = getTable(amoroTable);
List<PartitionFileBaseInfo> result = new ArrayList<>();
long commitId = Long.parseLong(snapshotId);
Snapshot snapshot;
if (mixedTable.isKeyedTable()) {
snapshot = mixedTable.asKeyedTable().changeTable().snapshot(commitId);
if (snapshot == null) {
snapshot = mixedTable.asKeyedTable().baseTable().snapshot(commitId);
}
} else {
snapshot = mixedTable.asUnkeyedTable().snapshot(commitId);
}
if (snapshot == null) {
throw new IllegalArgumentException(
"unknown snapshot " + snapshotId + " of " + amoroTable.id());
}
final long snapshotTime = snapshot.timestampMillis();
snapshot
.addedDataFiles(mixedTable.io())
.forEach(
f ->
result.add(
new PartitionFileBaseInfo(
snapshotId,
DataFileType.ofContentId(f.content().id()).name(),
snapshotTime,
MixedTableUtil.getMixedTablePartitionSpecById(mixedTable, f.specId())
.partitionToPath(f.partition()),
f.path().toString(),
f.fileSizeInBytes(),
"add")));
snapshot
.removedDataFiles(mixedTable.io())
.forEach(
f ->
result.add(
new PartitionFileBaseInfo(
snapshotId,
DataFileType.ofContentId(f.content().id()).name(),
snapshotTime,
MixedTableUtil.getMixedTablePartitionSpecById(mixedTable, f.specId())
.partitionToPath(f.partition()),
f.path().toString(),
f.fileSizeInBytes(),
"remove")));
snapshot
.addedDeleteFiles(mixedTable.io())
.forEach(
f ->
result.add(
new PartitionFileBaseInfo(
snapshotId,
DataFileType.ofContentId(f.content().id()).name(),
snapshotTime,
MixedTableUtil.getMixedTablePartitionSpecById(mixedTable, f.specId())
.partitionToPath(f.partition()),
f.path().toString(),
f.fileSizeInBytes(),
"add")));
snapshot
.removedDeleteFiles(mixedTable.io())
.forEach(
f ->
result.add(
new PartitionFileBaseInfo(
snapshotId,
DataFileType.ofContentId(f.content().id()).name(),
snapshotTime,
MixedTableUtil.getMixedTablePartitionSpecById(mixedTable, f.specId())
.partitionToPath(f.partition()),
f.path().toString(),
f.fileSizeInBytes(),
"remove")));
return result;
}