github-actions[bot] commented on code in PR #67152:
URL: https://github.com/apache/doris/pull/67152#discussion_r3878022747
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/FillUpQualifyMissingSlot.java:
##########
@@ -158,23 +222,67 @@ public List<Rule> buildRules() {
qualify -> having -> project(distinct)
*/
RuleType.FILL_UP_QUALIFY_HAVING_PROJECT.build(
- logicalQualify(logicalHaving(logicalProject())).then(qualify
-> {
+ logicalQualify(logicalHaving(logicalProject())).thenApply(ctx
-> {
+ LogicalQualify<LogicalHaving<LogicalProject<Plan>>>
qualify = ctx.root;
checkWindow(qualify);
+ Optional<Scope> outerScope =
ctx.cascadesContext.getOuterScope();
LogicalHaving<LogicalProject<Plan>> having =
qualify.child();
LogicalProject<Plan> project = qualify.child().child();
- return createPlan(project, qualify.getConjuncts(),
(newConjuncts, projects) -> {
+ return createPlan(project, qualify.getConjuncts(),
outerScope, (newConjuncts, projects) -> {
Review Comment:
[P1] Resolve correlated aliases consumed only by HAVING
This HAVING branch passes only the QUALIFY conjuncts into `createPlan`, so
an outer-only producer used through a SELECT alias only in HAVING is never
rewritten. For example, a correlated EXISTS can bind `f` locally in `Qualify[rn
= 1](Having[f = 1](Project[i.k, o.flag AS f, row_number(...) AS rn]))`.
`FillUpMissingSlots` then sees `f` in the project output and does nothing; the
window-bearing project prevents later correlation extraction, leaving `o.flag`
in the right subtree and final ownership validation rejects the query. The
aggregate HAVING sibling has the same omission because
`resolveCorrelatedAggregateOutputAlias` receives only QUALIFY predicates.
Please include HAVING conjuncts in the alias/output classification (or reject
this shape explicitly), retain the volatile/subquery/window safeguards, and add
full-pipeline project and grouped regressions.
--
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]