This is an automated email from the ASF dual-hosted git repository. xuyang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new bed759b3f5 [Fix](array-type) support CTAS for ARRAY column from collect_list and collect_set (#13627) bed759b3f5 is described below commit bed759b3f5e41d950f61151310e550ed0f706774 Author: camby <104178...@qq.com> AuthorDate: Wed Oct 26 19:42:15 2022 +0800 [Fix](array-type) support CTAS for ARRAY column from collect_list and collect_set (#13627) Co-authored-by: cambyzju <zhuxiaol...@baidu.com> --- .../src/main/java/org/apache/doris/analysis/FunctionCallExpr.java | 5 +++++ .../sql_functions/aggregate_functions/test_aggregate_collect.out | 3 +++ .../sql_functions/aggregate_functions/test_aggregate_collect.groovy | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java index 0884e3d414..e531c34994 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java @@ -1082,6 +1082,11 @@ public class FunctionCallExpr extends Expr { throw new AnalysisException(getFunctionNotFoundError(collectChildReturnTypes())); } + if (fnName.getFunction().equalsIgnoreCase("collect_list") + || fnName.getFunction().equalsIgnoreCase("collect_set")) { + fn.setReturnType(new ArrayType(getChild(0).type)); + } + applyAutoTypeConversionForDatetimeV2(); if (fnName.getFunction().equalsIgnoreCase("from_unixtime") diff --git a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_collect.out b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_collect.out index b18f47128c..d501683f7f 100644 --- a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_collect.out +++ b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_collect.out @@ -13,3 +13,6 @@ -- !select -- ['hello'] ['hello'] +-- !select -- +1 [1, 2, 1, 2] ['hello'] [2022-07-04, 2022-07-04] [1.23] ['hello', 'hello', 'hello', 'hello'] + diff --git a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_collect.groovy b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_collect.groovy index 3d3b8a00d4..cd7e61d408 100644 --- a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_collect.groovy +++ b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_collect.groovy @@ -19,7 +19,9 @@ suite("test_aggregate_collect") { sql "set enable_vectorized_engine = true" def tableName = "collect_test" + def tableCTAS = "collect_test_ctas" sql "DROP TABLE IF EXISTS ${tableName}" + sql "DROP TABLE IF EXISTS ${tableCTAS}" sql """ CREATE TABLE IF NOT EXISTS ${tableName} ( c_int INT, @@ -42,4 +44,7 @@ suite("test_aggregate_collect") { // test without GROUP BY qt_select "select collect_list(c_string),collect_list(c_string_not_null) from ${tableName}" qt_select "select collect_set(c_string),collect_set(c_string_not_null) from ${tableName}" + + sql """ CREATE TABLE ${tableCTAS} PROPERTIES("replication_num" = "1") AS SELECT 1,collect_list(c_int),collect_set(c_string),collect_list(c_date),collect_set(c_decimal),collect_list(c_string_not_null) FROM ${tableName} """ + qt_select "SELECT * from ${tableCTAS}" } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org