You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/04/26 06:12:36 UTC

[doris] branch master updated: [fix](planner) NPE when use ctas to create table (#18973)

This is an automated email from the ASF dual-hosted git repository.

morrysnow 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 50d9f35f63 [fix](planner) NPE when use ctas to create table (#18973)
50d9f35f63 is described below

commit 50d9f35f63dfcbbf07636be9d73762e86bd76acf
Author: AKIRA <33...@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 a71a7c9f0c..fcf8250739 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
@@ -1630,6 +1630,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 e17b82b2ec..27e12df4dd 100644
--- a/regression-test/suites/ddl_p0/test_ctas.groovy
+++ b/regression-test/suites/ddl_p0/test_ctas.groovy
@@ -152,6 +152,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 """
 
@@ -168,6 +194,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-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org