morrySnow commented on code in PR #34615:
URL: https://github.com/apache/doris/pull/34615#discussion_r1600878411


##########
fe/fe-core/src/main/java/org/apache/doris/common/NereidsSqlCacheManager.java:
##########
@@ -253,16 +257,28 @@ private boolean tablesOrDataChanged(Env env, 
SqlCacheContext sqlCacheContext) {
                 return true;
             }
             OlapTable olapTable = (OlapTable) tableIf;
-            long currentTableTime = olapTable.getVisibleVersionTime();
-            long cacheTableTime = scanTable.latestTimestamp;
+            //long currentTableTime = olapTable.getVisibleVersionTime();
+            //long cacheTableTime = scanTable.latestTimestamp;
             long currentTableVersion = olapTable.getVisibleVersion();
             long cacheTableVersion = scanTable.latestVersion;
             // some partitions have been dropped, or delete or updated or 
replaced, or insert rows into new partition?
-            if (currentTableTime > cacheTableTime
-                    || (currentTableTime == cacheTableTime && 
currentTableVersion > cacheTableVersion)) {
+            if (currentTableVersion != cacheTableVersion) {
                 return true;
             }
 
+            if (Config.isCloudMode()) {
+                Collection<Long> partitionIds = scanTable.getScanPartitions();
+                List<CloudPartition> partitions = partitionIds.stream()
+                        .sorted()
+                        .map(olapTable::getPartition)
+                        .map(partition -> (CloudPartition) partition)
+                        .collect(Collectors.toList());
+                try {
+                    CloudPartition.getSnapshotVisibleVersion(partitions);
+                } catch (RpcException e) {
+                    throw new RuntimeException(e);
+                }

Review Comment:
   add comment to explain what this code block use for



##########
fe/fe-core/src/main/java/org/apache/doris/qe/cache/CacheAnalyzer.java:
##########
@@ -697,15 +700,29 @@ private CacheTable 
buildCacheTableForOlapScanNode(OlapScanNode node) {
         CatalogIf catalog = database.getCatalog();
         ScanTable scanTable = new ScanTable(
                 new FullTableName(catalog.getName(), database.getFullName(), 
olapTable.getName()),
-                olapTable.getVisibleVersionTime(), 
olapTable.getVisibleVersion());
+                olapTable.getVisibleVersion());
+        // olapTable.getVisibleVersionTime(), olapTable.getVisibleVersion());
         scanTables.add(scanTable);
+        if (Config.isCloudMode()) {
+            Collection<Long> partitionIds = node.getSelectedPartitionIds();
+            List<CloudPartition> partitions = partitionIds.stream()
+                    .sorted()
+                    .map(olapTable::getPartition)
+                    .map(partition -> (CloudPartition) partition)
+                    .collect(Collectors.toList());
+            try {
+                CloudPartition.getSnapshotVisibleVersion(partitions);
+            } catch (RpcException e) {
+                throw new RuntimeException(e);
+            }
+        }

Review Comment:
   add comment to explain it



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to