Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyu committed Sep 26, 2024
1 parent e62988e commit bbdbb2f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public Identifier identifier() {

@Override
public Optional<Statistics> statistics() {
// todo: support time travel
Snapshot latestSnapshot = snapshotManager().latestSnapshot();
if (latestSnapshot != null) {
return store().newStatsFileHandler().readStats(latestSnapshot);
Expand All @@ -174,17 +175,16 @@ public Optional<Statistics> statistics() {
}

@Override
public Optional<Statistics> statistics(Long snapshotId) {
if (!snapshotManager().snapshotExists(snapshotId)) {
throw new SnapshotNotExistException(
String.format("snapshot id: %s is not existed", snapshotId));
}

public Optional<Statistics> statistics(long snapshotId) {
Long latestSnapshotId = snapshotManager().latestSnapshotId();
if (latestSnapshotId == null) {
return Optional.empty();
}

if (!snapshotManager().snapshotExists(snapshotId)) {
return store().newStatsFileHandler().readStats(snapshotManager().latestSnapshot());
}

while (latestSnapshotId > 0) {
Snapshot latestSnapshot = snapshotManager().snapshot(latestSnapshotId);
// reduce unnessary loop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public Optional<Statistics> statistics() {
}

@Override
public Optional<Statistics> statistics(Long snapshotId) {
public Optional<Statistics> statistics(long snapshotId) {
return wrapped.statistics(snapshotId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ default Optional<Statistics> statistics() {
}

@Override
default Optional<Statistics> statistics(Long snapshotId) {
default Optional<Statistics> statistics(long snapshotId) {
return Optional.empty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ default Optional<Statistics> statistics() {
}

@Override
default Optional<Statistics> statistics(Long snapshotId) {
default Optional<Statistics> statistics(long snapshotId) {
return Optional.empty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ default String fullName() {
Optional<Statistics> statistics();

@Experimental
Optional<Statistics> statistics(Long snapshotId);
Optional<Statistics> statistics(long snapshotId);

// ================= Table Operations ====================

Expand Down

0 comments on commit bbdbb2f

Please sign in to comment.