starocean999 commented on code in PR #51086:
URL: https://github.com/apache/doris/pull/51086#discussion_r2099226252
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SubqueryToApply.java:
##########
@@ -434,8 +434,14 @@ private Pair<LogicalPlan, Optional<Expression>>
addApply(SubqueryExpr subquery,
Preconditions.checkState(logicalProject.getOutputs().size() == 1,
"Scalar subuqery's should only output
1 column");
Slot aggSlot = agg.toSlot();
- replaceMap.put(aggSlot, new Alias(new
Nvl(aggSlot,
-
notNullableAggFunc.resultForEmptyInput())));
+ // we should keep the exprId, so that the
parent plan can bind this slot
+ replaceMap.put(aggSlot,
+ new Alias(
+ aggSlot.getExprId(),
Review Comment:
line 385: change
```
if (!ctx.subqueryIsAnalyzed(subqueryExpr)) {
tmpPlan = addApply(subqueryExpr, tmpPlan.first,
subqueryToMarkJoinSlot, ctx, conjunct,
isProject, subqueryExprs.size() == 1, isMarkJoinSlotNotNull);
}
```
to
```
if (!ctx.subqueryIsAnalyzed(subqueryExpr)) {
tmpPlan = addApply(subqueryExpr, tmpPlan.first,
subqueryToMarkJoinSlot, ctx, tmpPlan.second,
isProject, subqueryExprs.size() == 1, isMarkJoinSlotNotNull);
}
```
this should work and no need to keep expr id unchanged
--
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]