zddr commented on code in PR #47544:
URL: https://github.com/apache/doris/pull/47544#discussion_r1947630427


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonMetadataCache.java:
##########
@@ -94,18 +93,14 @@ private List<PaimonPartition> 
loadPartitions(PaimonSnapshotCacheKey key)
     }
 
     private PaimonSnapshot loadLatestSnapshot(PaimonSnapshotCacheKey key) 
throws IOException {
-        Table table = ((PaimonExternalCatalog) 
key.getCatalog()).getPaimonTable(key.getDbName(),
-                key.getTableName() + Catalog.SYSTEM_TABLE_SPLITTER + 
SnapshotsTable.SNAPSHOTS);
+        Table table = ((PaimonExternalCatalog) 
key.getCatalog()).getPaimonTable(key.getDbName(), key.getTableName());
         // snapshotId and schemaId
-        List<InternalRow> rows = PaimonUtil.read(table, new int[] {0, 1}, 
null);
         long latestSnapshotId = 0L;
         long latestSchemaId = 0L;
-        for (InternalRow row : rows) {
-            long snapshotId = row.getLong(0);
-            if (snapshotId > latestSnapshotId) {
-                latestSnapshotId = snapshotId;
-                latestSchemaId = row.getLong(1);
-            }
+        OptionalLong optionalSnapshotId = table.latestSnapshotId();
+        if (optionalSnapshotId.isPresent()) {

Review Comment:
   when will not present?if we should throw execption?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to