englefly commented on code in PR #64330:
URL: https://github.com/apache/doris/pull/64330#discussion_r3385401564
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PullUpProjectExprUnderTopN.java:
##########
@@ -634,17 +704,28 @@ private static LogicalProject<Plan>
addUpperProject(LogicalTopN topN, PullUpInfo
addPassThroughSlots(upperOutput, upperOutputExprIds,
passThroughOutputExprIds,
currentOutputByExprId, passThroughSlots);
} else {
- // Slot was lost during simplifyProject — pass through
directly.
- // TopN is a pass-through node; the computation for
this slot
- // exists below the TopN even if the intermediate
project lost it.
- if (upperOutputExprIds.add(origSlot.getExprId())) {
- upperOutput.add(origSlot);
- }
+ // When NestedColumnPruning has run before this rule,
the
+ // originalTopNOutput may contain intermediate
expression
+ // slots (element_at results) that were simplified
away by
+ // simplifyProject. These slots are no longer produced
by
+ // the rewritten TopN's child and would cause
CheckAfterRewrite
+ // failures if passed through. Skip them — the
corresponding
+ // computation is already covered by the pulled-up
Aliases
+ // or by the base slots added during simplification.
}
}
}
Review Comment:
r2
--
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]