github-actions[bot] commented on code in PR #67958:
URL: https://github.com/apache/doris/pull/67958#discussion_r4011895905
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PullUpProjectExprUnderTopN.java:
##########
@@ -174,9 +174,10 @@ private static void collectFromNode(Plan node, PullUpInfo
info, Set<ExprId> bloc
if (node instanceof LogicalProject) {
LogicalProject<? extends Plan> project = (LogicalProject<? extends
Plan>) node;
Set<ExprId> childBlockedExprIds = new HashSet<>(blockedExprIds);
+ Set<ExprId> repeatedIdentitySourceExprIds =
collectRepeatedIdentitySourceExprIds(project.getProjects());
for (NamedExpression ne : project.getProjects()) {
info.addPullUpExprReplace(ne);
- boolean canPullUp = canPullUp(ne);
+ boolean canPullUp = canPullUp(ne,
repeatedIdentitySourceExprIds);
Review Comment:
[P1] Keep a blocked alias's shared source eager
For `SELECT lazy_col AS first_alias, lazy_col AS second_alias FROM t ORDER
BY first_alias LIMIT 1`, the order key blocks only `first_alias`, so this
per-expression decision pulls `second_alias` and leaves `Project(lazy_col AS
first_alias, lazy_col)` below TopN. With
`topn_lazy_materialization_using_index=true`, the exposed `lazy_col` is then
classified lazy; `LazySlotPruning` removes it from the scan/direct projection
but retains `lazy_col AS first_alias`, and the final Validator rejects the plan
because the alias reads a slot its child no longer produces. Before this change
the lower identity Alias was rejected in the index path and the TopN stayed
eager, so this is a regression. Please make pull-up/materialization eligibility
coherent for the whole repeated-source group (or otherwise keep the shared
source eager) and cover ORDER BY alias/ordinal through final translation or
result verification.
--
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]