This is an automated email from the ASF dual-hosted git repository.

englefly pushed a commit to branch meta-path
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 054498bf702e7ce6e2d5431412f1bf090ba3cea0
Author: minghong <[email protected]>
AuthorDate: Tue Jul 7 15:55:51 2026 +0800

    (fe) support meta type path
---
 .../rules/rewrite/AccessPathExpressionCollector.java      |  4 ++++
 .../nereids/rules/rewrite/AccessPathPlanCollector.java    | 11 +----------
 .../doris/nereids/rules/rewrite/NestedColumnPruning.java  | 15 +++------------
 3 files changed, 8 insertions(+), 22 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathExpressionCollector.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathExpressionCollector.java
index 0633637b337..46f93ce6298 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathExpressionCollector.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathExpressionCollector.java
@@ -214,6 +214,7 @@ public class AccessPathExpressionCollector extends 
DefaultExpressionVisitor<Void
             CollectorContext offsetContext =
                     new CollectorContext(context.statementContext, 
context.bottomFilter);
             
offsetContext.accessPathBuilder.addSuffix(AccessPathInfo.ACCESS_OFFSET);
+            offsetContext.setType(ColumnAccessPathType.META);
             return arg.accept(this, offsetContext);
         }
         // fall through to default (recurse into children with fresh contexts)
@@ -232,6 +233,7 @@ public class AccessPathExpressionCollector extends 
DefaultExpressionVisitor<Void
             CollectorContext offsetContext =
                     new CollectorContext(context.statementContext, 
context.bottomFilter);
             
offsetContext.accessPathBuilder.addSuffix(AccessPathInfo.ACCESS_OFFSET);
+            offsetContext.setType(ColumnAccessPathType.META);
             return arg.accept(this, offsetContext);
         }
         return visit(mapSize, context);
@@ -251,6 +253,7 @@ public class AccessPathExpressionCollector extends 
DefaultExpressionVisitor<Void
             CollectorContext offsetContext =
                     new CollectorContext(context.statementContext, 
context.bottomFilter);
             
offsetContext.accessPathBuilder.addSuffix(AccessPathInfo.ACCESS_OFFSET);
+            offsetContext.setType(ColumnAccessPathType.META);
             // cardinality(map_keys(m)) == cardinality(m) == 
cardinality(map_values(m)):
             // all three count map entries, so emit the same [map_col, OFFSET] 
path.
             Expression effectiveArg = (arg instanceof MapKeys || arg 
instanceof MapValues)
@@ -642,6 +645,7 @@ public class AccessPathExpressionCollector extends 
DefaultExpressionVisitor<Void
             CollectorContext nullContext =
                     new CollectorContext(context.statementContext, 
context.bottomFilter);
             
nullContext.accessPathBuilder.addSuffix(AccessPathInfo.ACCESS_NULL);
+            nullContext.setType(ColumnAccessPathType.META);
             return continueCollectAccessPath(arg, nullContext);
         }
         return visit(isNull, context);
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathPlanCollector.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathPlanCollector.java
index 7e7674d2058..939eeef1e85 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathPlanCollector.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathPlanCollector.java
@@ -401,7 +401,7 @@ public class AccessPathPlanCollector extends 
DefaultPlanVisitor<Void, StatementC
         List<CollectAccessPathResult> normalizedAccessPaths = new 
ArrayList<>();
         for (CollectAccessPathResult accessPath : accessPaths) {
             List<String> path = accessPath.getPath();
-            if (isDataSkippingOnlyAccessPath(path) && path.size() > 1) {
+            if (accessPath.getType() == ColumnAccessPathType.META && 
path.size() > 1) {
                 // NULL/OFFSET suffixes are OLAP segment-reader-only 
optimizations. External
                 // table and TVF readers use access paths as real nested field 
paths, so read
                 // the referenced column/sub-column normally instead of 
sending a pseudo field.
@@ -415,13 +415,4 @@ public class AccessPathPlanCollector extends 
DefaultPlanVisitor<Void, StatementC
         }
         return normalizedAccessPaths;
     }
-
-    private static boolean isDataSkippingOnlyAccessPath(List<String> path) {
-        if (path.isEmpty()) {
-            return false;
-        }
-        String lastComponent = path.get(path.size() - 1);
-        return AccessPathInfo.ACCESS_NULL.equals(lastComponent)
-                || AccessPathInfo.ACCESS_OFFSET.equals(lastComponent);
-    }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NestedColumnPruning.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NestedColumnPruning.java
index 6ae6ef2b1ab..4d054aa4329 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NestedColumnPruning.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NestedColumnPruning.java
@@ -231,7 +231,7 @@ public class NestedColumnPruning implements CustomRewriter {
             Slot slot = kv.getKey();
             List<CollectAccessPathResult> collectAccessPathResults = 
kv.getValue();
             boolean hasRegularAccessPath = collectAccessPathResults.stream()
-                    .anyMatch(resultItem -> 
!isDataSkippingOnlyAccessPath(resultItem.getPath()));
+                    .anyMatch(resultItem -> resultItem.getType() != 
ColumnAccessPathType.META);
             if (slot.getDataType() instanceof VariantType) {
                 variantSlots.put(slot, slot.getDataType());
                 for (CollectAccessPathResult collectAccessPathResult : 
collectAccessPathResults) {
@@ -343,7 +343,7 @@ public class NestedColumnPruning implements CustomRewriter {
         List<String> path = accessPathResult.getPath();
         ColumnAccessPathType pathType = accessPathResult.getType();
         if (accessPathResult.isPredicate() && hasRegularAccessPath
-                && isDataSkippingOnlyAccessPath(path)) {
+                && pathType == ColumnAccessPathType.META) {
             if (hasMapStarAccessPath(slot, path)) {
                 // Keep map-star metadata until expandMapStarPaths() turns it 
into precise
                 // KEYS/VALUES paths. Stripping here would broaden map value 
reads to map.*.
@@ -404,16 +404,7 @@ public class NestedColumnPruning implements CustomRewriter 
{
     }
 
     private static boolean isMetaPath(ColumnAccessPath path) {
-        return isDataSkippingOnlyAccessPath(path.getPath());
-    }
-
-    private static boolean isDataSkippingOnlyAccessPath(List<String> 
components) {
-        if (components.isEmpty()) {
-            return false;
-        }
-        String lastComponent = components.get(components.size() - 1);
-        return AccessPathInfo.ACCESS_NULL.equals(lastComponent)
-                || AccessPathInfo.ACCESS_OFFSET.equals(lastComponent);
+        return path.getType() == ColumnAccessPathType.META;
     }
 
     private static List<String> stripDataSkippingSuffix(List<String> 
components) {


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

Reply via email to