Skip to content

Commit 34fb917

Browse files
[Enhancement] Avoid redundant latestSnapshot() call in PaimonMetadata#getTableVersionRange (backport #72892) (#73123)
Co-authored-by: haoyuhua <haoyuhua007@gmail.com>
1 parent 6e70559 commit 34fb917

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

fe/fe-core/src/main/java/com/starrocks/connector/paimon/PaimonMetadata.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,9 @@ public TvrVersionRange getTableVersionRange(String dbName, Table table,
301301
if (start.isEmpty() && end.isEmpty()) {
302302
long snapshotId = -1L;
303303
try {
304-
if (paimonTable.getNativeTable().latestSnapshot().isPresent()) {
305-
snapshotId = paimonTable.getNativeTable().latestSnapshot().get().id();
304+
Optional<Snapshot> latestSnapshot = paimonTable.getNativeTable().latestSnapshot();
305+
if (latestSnapshot.isPresent()) {
306+
snapshotId = latestSnapshot.get().id();
306307
}
307308
} catch (Exception e) {
308309
// System table does not have snapshotId, ignore it.

0 commit comments

Comments
 (0)