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

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


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

commit a461be6abfffa495236b2476e7bafa7321ce813a
Author: lw112 <[email protected]>
AuthorDate: Tue Apr 22 11:31:28 2025 +0800

    branch-3.0: [fix](agg) prevent core dump in ColumnArray::size_at when 
handling type mismatch in streaming_agg_serialize_to_column #50001 (#50098)
    
    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     |  31 +++++++++++++++++++++
 3 files changed, 33 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 67da77a4528..5ddc171b259 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_collect.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_collect.h
@@ -795,7 +795,8 @@ public:
                                     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&, 
TypeCheckOnRelease::DISABLE>(
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 4cae0205723..dfceed6e6d6 100644
--- a/regression-test/suites/query_p0/aggregate/array_agg.groovy
+++ b/regression-test/suites/query_p0/aggregate/array_agg.groovy
@@ -291,4 +291,35 @@ suite("array_agg") {
 
 
      qt_select """select array_sort(array_agg(k4)),array_sort(array_agg(k6)) 
from 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to