Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxiaojian committed Mar 2, 2024
1 parent bc83805 commit 1d2284c
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,23 @@ public List<TableBranch> branches() {
fileIO, new Path(getBranchPath(tablePath, branchName)));

SortedMap<Snapshot, List<String>> snapshotTags = branchTable.tagManager().tags();
Long earliestSnapshotId = branchTable.snapshotManager().earliestSnapshotId();
if (snapshotTags.isEmpty()) {
Long earliestSnapshotId = branchTable.snapshotManager().earliestSnapshotId();
// Create based on snapshotId.
branches.add(new TableBranch(branchName, earliestSnapshotId, path.getValue()));
} else {
Snapshot snapshot = snapshotTags.firstKey();
List<String> tags = snapshotTags.get(snapshot);
checkArgument(tags.size() == 1);
branches.add(
new TableBranch(branchName, tags.get(0), snapshot.id(), path.getValue()));
if (earliestSnapshotId == snapshot.id()) {
List<String> tags = snapshotTags.get(snapshot);
checkArgument(tags.size() == 1);
branches.add(
new TableBranch(
branchName, tags.get(0), snapshot.id(), path.getValue()));
} else {
// Create based on snapshotId.
branches.add(
new TableBranch(branchName, earliestSnapshotId, path.getValue()));
}
}
}

Expand Down

0 comments on commit 1d2284c

Please sign in to comment.