This is an automated email from the ASF dual-hosted git repository. yiguolei 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 40b3be8197d [fix](agg) prevent core dump in ColumnArray::size_at when handling type mismatch in streaming_agg_serialize_to_column (#50001) 40b3be8197d is described below commit 40b3be8197da0043e7cfb2808427d2e2d7a12dd1 Author: lw112 <131352377+felixw...@users.noreply.github.com> AuthorDate: Wed Apr 16 14:49:33 2025 +0800 [fix](agg) prevent core dump in ColumnArray::size_at when handling type mismatch in streaming_agg_serialize_to_column (#50001) ### What problem does this PR solve? Problem Summary: core ``` *** is nereids: 1 *** *** tablet id: 0 *** *** Aborted at 1744342233 (unix time) try "date -d @1744342233" if you are using GNU date *** *** Current BE git commitID: 2503281 *** *** SIGSEGV unknown detail explain (@0x0) received by PID 681431 (TID 683727 OR 0x7fcd153a0700) from PID 0; stack trace: *** 0# doris::signal::(anonymous namespace)::FailureSignalHandler(int, siginfo_t*, void*) in /usr/local/service/doris/lib/be/doris_be 1# os::Linux::chained_handler(int, siginfo*, void*) in /usr/local/jdk/jre/lib/amd64/server/libjvm.so 2# JVM_handle_linux_signal in /usr/local/jdk/jre/lib/amd64/server/libjvm.so 3# signalHandler(int, siginfo*, void*) in /usr/local/jdk/jre/lib/amd64/server/libjvm.so 4# 0x00007FD26771E400 in /lib64/libc.so.6 5# doris::vectorized::ColumnArray::insert_from(doris::vectorized::IColumn const&, unsigned long) in /usr/local/service/doris/lib/be/doris_be 6# doris::vectorized::ColumnNullable::insert_from(doris::vectorized::IColumn const&, unsigned long) in /usr/local/service/doris/lib/be/doris_be 7# doris::vectorized::AggregateFunctionCollect<doris::vectorized::AggregateFunctionArrayAggData<void>, std::integral_constant<bool, false>, std::integral_constant<bool, true> >::streaming_agg_serialize_to_column(doris::vectorized::IColumn const**, COW<doris::vectorized::IColumn>::mutable_ptr<doris::vectorized::IColumn>&, unsigned long, doris::vectorized::Arena*) const in /usr/local/service/doris/lib/be/doris_be 8# doris::vectorized::AggFnEvaluator::streaming_agg_serialize_to_column(doris::vectorized::Block*, COW<doris::vectorized::IColumn>::mutable_ptr<doris::vectorized::IColumn>&, unsigned long, doris::vectorized::Arena*) in /usr/local/service/doris/lib/be/doris_be 9# _ZNSt8__detail9__variant17__gen_vtable_implINS0_12_Multi_arrayIPFNS0_21__deduce_visit_resultIN5doris6StatusEEEONS4_10vectorized8OverloadIJZNS4_8pipeline22StreamingAggLocalState28_pre_agg_with_serialized_keyEPNS7_5BlockESC_E3$_0ZNSA_28_pre_agg_with_serialized_keyESC_SC_E3$_1EEERSt7variantIJNS7_16MethodSerializedI9PHHashMapINS4_9StringRefEPc11DefaultHashISK_vELb0EEEENS7_15MethodOneNumberIhSJ_IhSL_SM_IhvELb0EEEENSQ_ItSJ_ItSL_SM_ItvELb0EEEENSQ_IjSJ_IjSL_9HashCRC32IjELb0EEEENSQ_ImSJ_Im [...] 10# doris::pipeline::StreamingAggLocalState::_pre_agg_with_serialized_key(doris::vectorized::Block*, doris::vectorized::Block*) in /usr/local/service/doris/lib/be/doris_be 11# doris::pipeline::StreamingAggLocalState::do_pre_agg(doris::vectorized::Block*, doris::vectorized::Block*) in /usr/local/service/doris/lib/be/doris_be 12# doris::pipeline::StreamingAggOperatorX::push(doris::RuntimeState*, doris::vectorized::Block*, bool) const in /usr/local/service/doris/lib/be/doris_be 13# doris::pipeline::StatefulOperatorX<doris::pipeline::StreamingAggLocalState>::get_block(doris::RuntimeState*, doris::vectorized::Block*, bool*) in /usr/local/service/doris/lib/be/doris_be 14# doris::pipeline::OperatorXBase::get_block_after_projects(doris::RuntimeState*, doris::vectorized::Block*, bool*) in /usr/local/service/doris/lib/be/doris_be 15# doris::pipeline::PipelineXTask::execute(bool*) in /usr/local/service/doris/lib/be/doris_be 16# doris::pipeline::TaskScheduler::_do_work(unsigned long) in /usr/local/service/doris/lib/be/doris_be 17# doris::ThreadPool::dispatch_thread() in /usr/local/service/doris/lib/be/doris_be 18# doris::Thread::supervise_thread(void*) in /usr/local/service/doris/lib/be/doris_be 19# start_thread in /lib64/libpthread.so.0 20# __clone in /lib64/libc.so.6 ``` --- .../aggregate_function_collect.h | 3 +- .../data/query_p0/aggregate/array_agg.out | Bin 59884 -> 59963 bytes .../suites/query_p0/aggregate/array_agg.groovy | 52 ++++++++++++++++----- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_collect.h b/be/src/vec/aggregate_functions/aggregate_function_collect.h index ab60737cd7c..aff008dbf3c 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_collect.h +++ b/be/src/vec/aggregate_functions/aggregate_function_collect.h @@ -885,7 +885,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 f34157154cb..c20e7ce9623 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 56f40f11920..c78f84394fd 100644 --- a/regression-test/suites/query_p0/aggregate/array_agg.groovy +++ b/regression-test/suites/query_p0/aggregate/array_agg.groovy @@ -38,7 +38,7 @@ suite("array_agg") { "disable_auto_compaction" = "false", "enable_single_replica_compaction" = "false" ); - """ + """ sql """ CREATE TABLE `test_array_agg_int` ( @@ -57,7 +57,7 @@ suite("array_agg") { "disable_auto_compaction" = "false", "enable_single_replica_compaction" = "false" ); - """ + """ sql """ CREATE TABLE `test_array_agg_decimal` ( @@ -78,7 +78,7 @@ suite("array_agg") { "disable_auto_compaction" = "false", "enable_single_replica_compaction" = "false" ); - """ + """ sql """ insert into `test_array_agg` values @@ -108,8 +108,8 @@ suite("array_agg") { (7, "LC", "V7_3"), (7, "LC", NULL), (7, NULL, "V7_3"); - """ - + """ + sql """ insert into `test_array_agg_int` values (1, "alex",NULL,NULL), @@ -137,7 +137,7 @@ suite("array_agg") { (7, "LC", "V7_3",NULL), (7, "LC", NULL,NULL), (7, NULL, "V7_3",NULL); - """ + """ sql """ insert into `test_array_agg_decimal` values @@ -158,7 +158,7 @@ suite("array_agg") { (5, "LC", "V5_3",NULL,NULL,"alexcoco662"), (7, "", NULL,NULL,NULL,"alexcoco1"), (8, "", NULL,0,NULL,"alexcoco2"); - """ + """ order_qt_sql1 """ SELECT count(id), array_agg(`label_name`) FROM `test_array_agg` GROUP BY `id` order by id; @@ -197,7 +197,7 @@ suite("array_agg") { """ - // test for bucket 10 + // test for bucket 10 sql """ CREATE TABLE `test_array_agg1` ( `id` int(11) NOT NULL, `label_name` varchar(32) default null, @@ -243,7 +243,7 @@ suite("array_agg") { (7, "LC", NULL), (7, NULL, "V7_3"); """ - + order_qt_sql11 """ SELECT count(id), size(array_agg(`label_name`)) FROM `test_array_agg` GROUP BY `id` order by id; """ @@ -314,7 +314,7 @@ suite("array_agg") { k1 BIGINT , k4 ipv4 , k6 ipv6 , - s string + s string ) DISTRIBUTED BY HASH(k1) BUCKETS 1 PROPERTIES("replication_num" = "1"); """ sql """ insert into test_array_agg_ip values(1,123,34141,"0.0.0.123") , (2,3114,318903,"0.0.0.123") , (3,7832131,192837891738927931231,"2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D"),(4,null,null,"2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D"); """ @@ -323,8 +323,38 @@ suite("array_agg") { qt_select """select array_sort(array_agg(k4)),array_sort(array_agg(k6)) from test_array_agg_ip """ sql "DROP TABLE `test_array_agg`" - sql "DROP TABLE `test_array_agg1`" + sql "DROP TABLE `test_array_agg1`" 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_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