github-actions[bot] commented on code in PR #63229:
URL: https://github.com/apache/doris/pull/63229#discussion_r3236608463


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathExpressionCollector.java:
##########
@@ -245,6 +247,11 @@ public Void visitCardinality(Cardinality cardinality, 
CollectorContext context)
         return visit(cardinality, context);
     }
 
+    private boolean isMapElementAccessResult(Expression arg) {
+        return arg instanceof ElementAt
+                && ((ElementAt) 
arg).getArguments().get(0).getDataType().isMapType();

Review Comment:
   This only catches a bare `ElementAt`. If the map lookup is wrapped in a 
no-op cast, for example `cardinality(CAST(element_at(struct_element(s, 'm'), 
'null') AS ARRAY<STRUCT<verified: BOOLEAN, value: INT>>))`, `visitCardinality` 
still takes the offset-only branch because the argument type is `ARRAY` and the 
argument itself is `Cast`, not `ElementAt`. Then `visitCast` forwards the 
`OFFSET` suffix to `visitElementAt`, producing the same invalid `s.m.*.OFFSET` 
access path this PR is trying to avoid. Please detect map-element access 
through transparent wrappers (or avoid pushing `OFFSET` once traversal reaches 
a map `ElementAt`) and add coverage for that case.



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