morrySnow commented on code in PR #31115: URL: https://github.com/apache/doris/pull/31115#discussion_r1496932557
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ExtractAndNormalizeWindowExpression.java: ########## @@ -91,7 +92,17 @@ public Rule build() { // 2. handle window's outputs and windowExprs // need to replace exprs with SlotReference in WindowSpec, due to LogicalWindow.getExpressions() - List<NamedExpression> normalizedOutputs1 = context.normalizeToUseSlotRef(outputs); + + // because alias is pushed down to bottom project + // we need replace alias's child expr with corresponding alias's slot in output + // so create a customNormalizeMap alias's child -> alias.toSlot to do it + Map<Expression, Slot> customNormalizeMap = toBePushedDown.stream() + .filter(expr -> expr instanceof Alias) + .collect(Collectors.toMap(expr -> ((Alias) expr).child(), expr -> ((Alias) expr).toSlot(), + (oldExpr, newExpr) -> oldExpr)); + + List<NamedExpression> normalizedOutputs1 = context.normalizeToUseSlotRef(outputs, Review Comment: could we change normalizedOutputs1 to a better name? -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org