englefly commented on code in PR #64436:
URL: https://github.com/apache/doris/pull/64436#discussion_r3421006762
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AccessPathExpressionCollector.java:
##########
@@ -618,6 +618,30 @@ private Void collectArrayPathInLambda(Lambda lambda,
CollectorContext context) {
} finally {
nameToLambdaArguments.pop();
}
+
+ // After visiting the lambda body, for any bound array whose lambda
variable
+ // was NOT referenced in the body (e.g. x -> true where x never
appears),
+ // visitArrayItemSlot was never called and the array column's access
path is
+ // missing. This gap is exposed when an is-null or offset-only path
has been
+ // registered for the same slot — NestedColumnPruning then incorrectly
prunes
+ // the complex column to null-only / offset-only instead of reading
full data.
+ //
+ // Must use a fresh context: when the body DOES reference some
variables
+ // (e.g. (x,y) -> x > 0), visitArrayItemSlot mutates
context.accessPathBuilder
+ // in-place (addPrefix without cleanup). A fresh context isolates the
fallback
+ // path for unreferenced variables from pollution by referenced ones.
+ for (Expression argument : arguments) {
+ if (argument instanceof ArrayItemReference) {
+ Expression boundArray = argument.child(0);
+ if
(!arguments.get(0).getInputSlots().containsAll(boundArray.getInputSlots())) {
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]