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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindRelation.java:
##########
@@ -1056,14 +1074,18 @@ private Plan parseAndAnalyzeView(TableIf view, String 
ddlSql, CascadesContext pa
 
     private List<Long> getPartitionIds(TableIf t, UnboundRelation 
unboundRelation, List<String> qualifier) {
         List<String> parts = unboundRelation.getPartNames();
-        if (CollectionUtils.isEmpty(parts)) {
+        if (CollectionUtils.isEmpty(parts) && 
!unboundRelation.isMaxVisiblePartition()) {
             return ImmutableList.of();
         }
         if (!t.isManagedTable()) {
             throw new AnalysisException(String.format(
                     "Only OLAP table is support select by partition for now,"
                             + "Table: %s is not OLAP table", t.getName()));
         }
+        if (unboundRelation.isMaxVisiblePartition()) {
+            Partition partition = t.getMaxVisiblePartition();
+            return partition == null ? ImmutableList.of() : 
ImmutableList.of(partition.getId());

Review Comment:
   Thanks for the detailed scenario. MAX_VISIBLE_PARTITION() is designed for 
ordinary snapshot table scans. Combining it with change-read scan parameters 
such as @incr() is outside the intended scope of this feature.
   
   Preserving an explicit empty partition selection would require changing the 
shared scan representation, where an empty manually specified partition list 
currently means unrestricted scanning. We do not want to introduce a new 
cross-cutting partition-selection state in this PR solely for an unsupported 
combination.
   
   I suggest tracking support for MAX_VISIBLE_PARTITION() with change reads 
separately. This PR focuses on ordinary OLAP/MTMV snapshot queries.



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