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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new c3a201dcbf2 branch-2.1: [fix](agg) prevent core dump in 
ColumnArray::size_at when handling type mismatch in 
streaming_agg_serialize_to_column #50001 (#50095)
c3a201dcbf2 is described below

commit c3a201dcbf28d24075d7fbddbf8c77bfa95df1e6
Author: lw112 <131352377+felixw...@users.noreply.github.com>
AuthorDate: Thu Apr 17 09:30:06 2025 +0800

    branch-2.1: [fix](agg) prevent core dump in ColumnArray::size_at when 
handling type mismatch in streaming_agg_serialize_to_column #50001 (#50095)
    
    ### What problem does this PR solve?
    
    Cherry-picked from: #50001
---
 .../aggregate_function_collect.h                   |   3 ++-
 .../data/query_p0/aggregate/array_agg.out          | Bin 8132 -> 8211 bytes
 .../suites/query_p0/aggregate/array_agg.groovy     |  29 +++++++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/aggregate_functions/aggregate_function_collect.h 
b/be/src/vec/aggregate_functions/aggregate_function_collect.h
index de58f628ec9..ccb327226ee 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_collect.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_collect.h
@@ -782,7 +782,8 @@ public:
                             assert_cast<const 
ColumnString&>(col_src.get_nested_column());
                     vec.insert_from(vec_src, i);
                 } else if constexpr (std::is_same_v<Data, 
AggregateFunctionArrayAggData<void>>) {
-                    to_nested_col.insert_from(col_src.get_nested_column(), i);
+                    auto& vec = col_null->get_nested_column();
+                    vec.insert_from(col_src.get_nested_column(), i);
                 } else {
                     using ColVecType = ColumnVectorOrDecimal<typename 
Data::ElementType>;
                     auto& vec = 
assert_cast<ColVecType&>(col_null->get_nested_column()).get_data();
diff --git a/regression-test/data/query_p0/aggregate/array_agg.out 
b/regression-test/data/query_p0/aggregate/array_agg.out
index 62ffb5fcf47..fa74d37c00d 100644
Binary files a/regression-test/data/query_p0/aggregate/array_agg.out and 
b/regression-test/data/query_p0/aggregate/array_agg.out differ
diff --git a/regression-test/suites/query_p0/aggregate/array_agg.groovy 
b/regression-test/suites/query_p0/aggregate/array_agg.groovy
index 42fb3b131a4..c4e6a5d2825 100644
--- a/regression-test/suites/query_p0/aggregate/array_agg.groovy
+++ b/regression-test/suites/query_p0/aggregate/array_agg.groovy
@@ -297,4 +297,33 @@ suite("array_agg") {
     sql "DROP TABLE `test_array_agg_int`"
     sql "DROP TABLE `test_array_agg_decimal`"
     sql "DROP TABLE `test_array_agg_ip`"
+    
+    sql """ drop table if exists test_user_tags;"""
+
+    sql """
+    CREATE TABLE test_user_tags (
+        k1 varchar(150) NULL,
+        k2 varchar(150) NULL,
+        k3 varchar(150) NULL,
+        k4 array<varchar(150)> NULL,
+        k5 array<varchar(150)> NULL,
+        k6 datetime NULL
+    ) ENGINE=OLAP
+    UNIQUE KEY(k1, k2, k3)
+    DISTRIBUTED BY HASH(k2) BUCKETS 3
+    PROPERTIES ("replication_allocation" = "tag.location.default: 1");
+    """
+    
+    sql """
+    INSERT INTO test_user_tags VALUES
+          ('corp001', 'wx001', 'vip', ['id1', 'id2'], ['tag1', 'tag2'], 
'2023-01-01 10:00:00'),
+          ('corp001', 'wx001', 'level', ['id3'], ['tag3'], '2023-01-01 
10:00:00'),
+          ('corp002', 'wx002', 'vip', ['id4', 'id5'], ['tag4', 'tag5'], 
'2023-01-02 10:00:00');
+    """
+    sql "SET spill_streaming_agg_mem_limit = 1024;"
+    sql "SET enable_agg_spill = true;"    
+
+    qt_select """ SELECT k1,array_agg(k5) FROM test_user_tags group by k1 
order by k1; """
+
+    sql "UNSET VARIABLE ALL;"
 }


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

Reply via email to