re20052 commented on code in PR #66187:
URL: https://github.com/apache/doris/pull/66187#discussion_r3688220993


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java:
##########
@@ -1508,6 +1508,42 @@ public Partition getPartition(String partitionName, 
boolean isTempPartition) {
         }
     }
 
+    @Override
+    public Partition getMaxVisiblePartition() {
+        PartitionInfo partitionInfo = getPartitionInfo();
+        PartitionType type = partitionInfo.getType();
+        // LIST has no natural "latest"; UNPARTITIONED has a single partition.
+        // Neither participates in the range-max scan below.
+        if (type == PartitionType.LIST) {
+            // no meaningful "max" partition -> caller builds an empty query
+            return null;
+        }
+        if (type == PartitionType.UNPARTITIONED) {
+            for (Partition partition : nameToPartition.values()) {
+                if (partition.getVisibleVersion() > 
Partition.PARTITION_INIT_VERSION) {
+                    return partition;
+                }
+            }
+            return null;
+        }
+        Partition result = null;
+        PartitionKey maxUpperBound = null;
+        for (Partition partition : nameToPartition.values()) {
+            if (partition.getVisibleVersion() <= 
Partition.PARTITION_INIT_VERSION) {

Review Comment:
   done!



-- 
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