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 dcf3eb34345 branch-2.1: [fix](agg) Fixed a core dump when using the 
IPv6 type in array_agg. #44877 (#44918)
dcf3eb34345 is described below

commit dcf3eb343450ca0ea8239ed1868cd8ba0ea63176
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Dec 4 22:05:00 2024 +0800

    branch-2.1: [fix](agg) Fixed a core dump when using the IPv6 type in 
array_agg. #44877 (#44918)
    
    Cherry-picked from #44877
    
    Co-authored-by: Mryange <[email protected]>
---
 .../aggregate_functions/aggregate_function_collect.cpp   | 10 ++++++++--
 regression-test/data/query_p0/aggregate/array_agg.out    |  3 +++
 .../suites/query_p0/aggregate/array_agg.groovy           | 16 ++++++++++++++++
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/be/src/vec/aggregate_functions/aggregate_function_collect.cpp 
b/be/src/vec/aggregate_functions/aggregate_function_collect.cpp
index d726b7c6355..552d47d3567 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_collect.cpp
+++ b/be/src/vec/aggregate_functions/aggregate_function_collect.cpp
@@ -72,12 +72,18 @@ AggregateFunctionPtr 
create_aggregate_function_collect_impl(const std::string& n
     if (which.is_date_or_datetime()) {
         return do_create_agg_function_collect<Int64, HasLimit, 
ShowNull>(distinct, argument_types,
                                                                          
result_is_nullable);
-    } else if (which.is_date_v2() || which.is_ipv4()) {
+    } else if (which.is_date_v2()) {
         return do_create_agg_function_collect<UInt32, HasLimit, 
ShowNull>(distinct, argument_types,
                                                                           
result_is_nullable);
-    } else if (which.is_date_time_v2() || which.is_ipv6()) {
+    } else if (which.is_date_time_v2()) {
         return do_create_agg_function_collect<UInt64, HasLimit, 
ShowNull>(distinct, argument_types,
                                                                           
result_is_nullable);
+    } else if (which.is_ipv6()) {
+        return do_create_agg_function_collect<IPv6, HasLimit, 
ShowNull>(distinct, argument_types,
+                                                                        
result_is_nullable);
+    } else if (which.is_ipv4()) {
+        return do_create_agg_function_collect<IPv4, HasLimit, 
ShowNull>(distinct, argument_types,
+                                                                        
result_is_nullable);
     } else if (which.is_string()) {
         return do_create_agg_function_collect<StringRef, HasLimit, ShowNull>(
                 distinct, argument_types, result_is_nullable);
diff --git a/regression-test/data/query_p0/aggregate/array_agg.out 
b/regression-test/data/query_p0/aggregate/array_agg.out
index 1fe44df3a14..62ffb5fcf47 100644
--- a/regression-test/data/query_p0/aggregate/array_agg.out
+++ b/regression-test/data/query_p0/aggregate/array_agg.out
@@ -251,3 +251,6 @@
 8      [{"id":8}, {"id":8}, {"id":8}, {"id":8}]
 9      [{"id":9}, {"id":9}, {"id":9}, {"id":9}]
 
+-- !select --
+[null, "0.0.0.123", "0.0.12.42", "0.119.130.67"]       [null, "::855d", 
"::0.4.221.183", "::a:7429:d0d6:6e08:9f5f"]
+
diff --git a/regression-test/suites/query_p0/aggregate/array_agg.groovy 
b/regression-test/suites/query_p0/aggregate/array_agg.groovy
index 217285b572c..42fb3b131a4 100644
--- a/regression-test/suites/query_p0/aggregate/array_agg.groovy
+++ b/regression-test/suites/query_p0/aggregate/array_agg.groovy
@@ -277,8 +277,24 @@ suite("array_agg") {
     order_qt_sql_array_agg_map """ SELECT id, array_agg(km) FROM 
test_array_agg_complex GROUP BY id ORDER BY id """
     order_qt_sql_array_agg_struct """ SELECT id, array_agg(ks) FROM 
test_array_agg_complex GROUP BY id ORDER BY id """
 
+
+ sql """ DROP TABLE IF EXISTS test_array_agg_ip;"""
+    sql """
+        CREATE TABLE test_array_agg_ip(
+            k1 BIGINT ,
+            k4 ipv4 ,
+            k6 ipv6 ,
+            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");
 """
+
+
+     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_agg_int`"
     sql "DROP TABLE `test_array_agg_decimal`"
+    sql "DROP TABLE `test_array_agg_ip`"
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to