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 01e4522612 [fix]collect_list/collect_set without GROUP BY for NOT NULL 
column (#11529)
01e4522612 is described below

commit 01e4522612a582f0c3021c42254f0b0e1db2abd1
Author: camby <104178...@qq.com>
AuthorDate: Tue Aug 9 20:49:37 2022 +0800

    [fix]collect_list/collect_set without GROUP BY for NOT NULL column (#11529)
    
    Co-authored-by: cambyzju <zhuxiaol...@baidu.com>
---
 be/src/vec/exec/vaggregation_node.cpp                         | 11 ++++++-----
 .../aggregate_functions/test_aggregate_collect.out            |  6 ++++++
 .../aggregate_functions/test_aggregate_collect.groovy         | 11 ++++++++---
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/be/src/vec/exec/vaggregation_node.cpp 
b/be/src/vec/exec/vaggregation_node.cpp
index 1bdccbd614..e488e6d9a6 100644
--- a/be/src/vec/exec/vaggregation_node.cpp
+++ b/be/src/vec/exec/vaggregation_node.cpp
@@ -531,11 +531,12 @@ Status 
AggregationNode::_get_without_key_result(RuntimeState* state, Block* bloc
     for (int i = 0; i < block_schema.size(); ++i) {
         const auto column_type = block_schema[i].type;
         if (!column_type->equals(*data_types[i])) {
-            DCHECK(column_type->is_nullable());
-            DCHECK(((DataTypeNullable*)column_type.get())
-                           ->get_nested_type()
-                           ->equals(*data_types[i]));
-            DCHECK(!data_types[i]->is_nullable());
+            if (!is_array(remove_nullable(column_type))) {
+                DCHECK(column_type->is_nullable());
+                DCHECK(!data_types[i]->is_nullable());
+                DCHECK(remove_nullable(column_type)->equals(*data_types[i]));
+            }
+
             ColumnPtr ptr = std::move(columns[i]);
             // unless `count`, other aggregate function dispose empty set 
should be null
             // so here check the children row return
diff --git 
a/regression-test/data/query/sql_functions/aggregate_functions/test_aggregate_collect.out
 
b/regression-test/data/query/sql_functions/aggregate_functions/test_aggregate_collect.out
index cec8df6151..b18f47128c 100644
--- 
a/regression-test/data/query/sql_functions/aggregate_functions/test_aggregate_collect.out
+++ 
b/regression-test/data/query/sql_functions/aggregate_functions/test_aggregate_collect.out
@@ -7,3 +7,9 @@
 1      ['hello']       [2022-07-04]    [1.23]
 2      \N      \N      \N
 
+-- !select --
+['hello', 'hello']     ['hello', 'hello', 'hello', 'hello']
+
+-- !select --
+['hello']      ['hello']
+
diff --git 
a/regression-test/suites/query/sql_functions/aggregate_functions/test_aggregate_collect.groovy
 
b/regression-test/suites/query/sql_functions/aggregate_functions/test_aggregate_collect.groovy
index a1c1ff260e..064b3d9fac 100644
--- 
a/regression-test/suites/query/sql_functions/aggregate_functions/test_aggregate_collect.groovy
+++ 
b/regression-test/suites/query/sql_functions/aggregate_functions/test_aggregate_collect.groovy
@@ -26,16 +26,21 @@ suite("test_aggregate_collect", "query") {
                c_int INT,
                c_string VARCHAR(10),
           c_date Date,
-          c_decimal DECIMAL(10, 2)
+          c_decimal DECIMAL(10, 2),
+          c_string_not_null VARCHAR(10) NOT NULL
            )
            DISTRIBUTED BY HASH(c_int) BUCKETS 1
            PROPERTIES (
              "replication_num" = "1"
            ) 
     """
-    sql "INSERT INTO ${tableName} values(1,'hello','2022-07-04',1.23), 
(2,NULL,NULL,NULL)"
-    sql "INSERT INTO ${tableName} values(1,'hello','2022-07-04',1.23), 
(2,NULL,NULL,NULL)"
+    sql "INSERT INTO ${tableName} values(1,'hello','2022-07-04',1.23,'hello'), 
(2,NULL,NULL,NULL,'hello')"
+    sql "INSERT INTO ${tableName} values(1,'hello','2022-07-04',1.23,'hello'), 
(2,NULL,NULL,NULL,'hello')"
 
     qt_select "select 
c_int,collect_list(c_string),collect_list(c_date),collect_list(c_decimal) from 
${tableName} group by c_int order by c_int"
     qt_select "select 
c_int,collect_set(c_string),collect_set(c_date),collect_set(c_decimal) from 
${tableName} group by c_int order by c_int"
+
+    // 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}"
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to