This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
commit 19d97ae1ed44c9f7a51783868f96a4715b1163a0 Author: AKIRA <33112463+kikyou1...@users.noreply.github.com> AuthorDate: Wed Apr 26 15:12:28 2023 +0900 [fix](planner) NPE when use ctas to create table (#18973) This is caused by expr in orderbyelements is not analyzed. --- .../apache/doris/analysis/FunctionCallExpr.java | 5 ++++ regression-test/suites/ddl_p0/test_ctas.groovy | 34 ++++++++++++++++++++++ 2 files changed, 39 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 2500e67b7e..c24777ae60 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 @@ -1455,6 +1455,11 @@ public class FunctionCallExpr extends Expr { } // rewrite return type if is nested type function analyzeNestedFunction(); + for (OrderByElement o : orderByElements) { + if (!o.getExpr().isAnalyzed) { + o.getExpr().analyzeImpl(analyzer); + } + } } // if return type is nested type, need to be determined the sub-element type diff --git a/regression-test/suites/ddl_p0/test_ctas.groovy b/regression-test/suites/ddl_p0/test_ctas.groovy index 34688afe13..e03e0e38da 100644 --- a/regression-test/suites/ddl_p0/test_ctas.groovy +++ b/regression-test/suites/ddl_p0/test_ctas.groovy @@ -146,6 +146,32 @@ suite("test_ctas") { and substring(col8, 1, 10) = '1451601'; """ + sql """ + DROP TABLE IF EXISTS tbl_3210581 + """ + + sql """ + CREATE TABLE tbl_3210581 (col1 varchar(11451) not null, col2 int not null, col3 int not null) + UNIQUE KEY(`col1`) + DISTRIBUTED BY HASH(col1) + BUCKETS 3 + PROPERTIES( + "replication_num"="1" + ) + """ + + sql """ + DROP TABLE IF EXISTS ctas_113815; + """ + + sql """ + create table ctas_113815 + PROPERTIES('replication_num' = '1') + as + select group_concat(col1 ORDER BY col1) from `tbl_3210581` + group by `col2`; + """ + } finally { sql """ DROP TABLE IF EXISTS test_ctas """ @@ -162,6 +188,14 @@ suite("test_ctas") { sql """DROP TABLE IF EXISTS test_tbl_81748325""" sql """DROP TABLE IF EXISTS test_tbl_3156019""" + + sql """ + DROP TABLE IF EXISTS tbl_3210581 + """ + + sql """ + DROP TABLE IF EXISTS ctas_113815 + """ } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org