This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
commit fe7d2b81591b953bd2837259341627da1dd8dbeb Author: feiniaofeiafei <[email protected]> AuthorDate: Mon Apr 29 11:00:05 2024 +0800 [Fix](nereids) ignore slot implements SlotNotFromChildren when check the slot from children in NormalizeAggregate (#34171) --- .../doris/nereids/rules/analysis/NormalizeAggregate.java | 3 ++- .../data/nereids_function_p0/scalar_function/Array.out | 15 +++++++++++++++ .../nereids_function_p0/scalar_function/Array.groovy | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java index e9b3d32da6e..e920036247c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/NormalizeAggregate.java @@ -27,6 +27,7 @@ import org.apache.doris.nereids.trees.expressions.ExprId; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.NamedExpression; import org.apache.doris.nereids.trees.expressions.Slot; +import org.apache.doris.nereids.trees.expressions.SlotNotFromChildren; import org.apache.doris.nereids.trees.expressions.SlotReference; import org.apache.doris.nereids.trees.expressions.SubqueryExpr; import org.apache.doris.nereids.trees.expressions.WindowExpression; @@ -269,7 +270,7 @@ public class NormalizeAggregate implements RewriteRuleFactory, NormalizeToSlot { } List<Slot> errorSlots = new ArrayList<>(slots.size()); for (Slot slot : slots) { - if (!aggOutputExprIds.contains(slot.getExprId())) { + if (!aggOutputExprIds.contains(slot.getExprId()) && !(slot instanceof SlotNotFromChildren)) { errorSlots.add(slot); } } diff --git a/regression-test/data/nereids_function_p0/scalar_function/Array.out b/regression-test/data/nereids_function_p0/scalar_function/Array.out index 0ac1f221443..c6c32bf9b15 100644 --- a/regression-test/data/nereids_function_p0/scalar_function/Array.out +++ b/regression-test/data/nereids_function_p0/scalar_function/Array.out @@ -11976,6 +11976,21 @@ true [1, 1] [1, 1] +-- !sql_array_map_lambda_agg -- +[101] +[102] +[103] +[104] +[105] +[106] +[107] +[108] +[109] +[110] +[111] +[112] +[] + -- !sql_array_exists_Double -- \N [0] diff --git a/regression-test/suites/nereids_function_p0/scalar_function/Array.groovy b/regression-test/suites/nereids_function_p0/scalar_function/Array.groovy index 14a9453632a..5b13ed4590b 100644 --- a/regression-test/suites/nereids_function_p0/scalar_function/Array.groovy +++ b/regression-test/suites/nereids_function_p0/scalar_function/Array.groovy @@ -1005,6 +1005,8 @@ suite("nereids_scalar_fn_Array") { order_qt_sql_array_map_TinyInt_notnull "select array_map(x -> x is not null, katint) from fn_test_not_nullable" order_qt_sql_array_map_DecimalV3 "select array_map(x -> x is not null, kadcml) from fn_test" order_qt_sql_array_map_DecimalV3_notnull "select array_map(x -> x is not null, kadcml) from fn_test_not_nullable" + order_qt_sql_array_map_lambda_agg "select array_map(x->(x+100), collect_list(ktint)) from fn_test group by id;" + // test array_exists order_qt_sql_array_exists_Double "select array_exists(x -> x > 1, kadbl) from fn_test" order_qt_sql_array_exists_Double_notnull "select array_exists(x -> x > 1, kadbl) from fn_test_not_nullable" --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
