This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-2.0-alpha in repository https://gitbox.apache.org/repos/asf/doris.git
commit 9d199e38688f541bc293c01dda75161723c8d55c Author: zhangstar333 <[email protected]> AuthorDate: Tue Apr 18 12:01:44 2023 +0800 [vectorzied](function) fix array_map function analyzed failed with order by clause (#18676) * [vectorzied](function) fix array_map function analyzed failed with order by clause * add test --- .../main/java/org/apache/doris/analysis/LambdaFunctionExpr.java | 7 +++++-- .../sql_functions/array_functions/test_array_map_function.out | 6 ++++++ .../sql_functions/array_functions/test_array_map_function.groovy | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/LambdaFunctionExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/LambdaFunctionExpr.java index 1983b4f3e1..15c37ad850 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/LambdaFunctionExpr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/LambdaFunctionExpr.java @@ -82,11 +82,14 @@ public class LambdaFunctionExpr extends Expr { nameSet.add(names.get(i)); } Expr param = params.get(i); + if (!param.isAnalyzed()) { + param.analyze(analyzer); + } Type paramType = param.getType(); if (!paramType.isArrayType()) { throw new AnalysisException( - "The lambda function of params must be array type, now " + (i + 1) + "th is " - + paramType.toString()); + "The lambda function of params must be array type, now the param of " + + param.toColumnLabel() + " is " + paramType.toString()); } // this ColumnRefExpr record the unique columnId, which is used for BE // so could insert nested column by order. diff --git a/regression-test/data/query_p0/sql_functions/array_functions/test_array_map_function.out b/regression-test/data/query_p0/sql_functions/array_functions/test_array_map_function.out index ab77b819a4..470d4a3ca5 100644 --- a/regression-test/data/query_p0/sql_functions/array_functions/test_array_map_function.out +++ b/regression-test/data/query_p0/sql_functions/array_functions/test_array_map_function.out @@ -110,3 +110,9 @@ 3 [1] [-100] [-100] 4 \N \N \N +-- !select_24 -- +4 \N \N +3 [1] [-100] +1 [1, 2, 3, 4, 5] [10, 20, -40, 80, -100] +2 [6, 7, 8] [10, 12, 13] + diff --git a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_map_function.groovy b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_map_function.groovy index e516a12b03..b5d4fbbe9d 100644 --- a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_map_function.groovy +++ b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_map_function.groovy @@ -68,6 +68,8 @@ suite("test_array_map_function") { qt_select_21 "select array_filter(x->abs(x), [1,2]);" qt_select_22 "select *,array_filter(x->x%2=0,c_array1) from array_test2 order by id;" qt_select_23 "select *,array_filter(x->x%2=0,c_array2) from array_test2 order by id;" + + qt_select_24 "select * from array_test2 order by array_max(array_map(x->x,c_array1));" sql "DROP TABLE IF EXISTS ${tableName}" } \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
