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

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


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 2ab394e4599 branch-3.1: [fix](collect_list) fix collect_list in multi 
BE will ser/de failed #48314 (#56752)
2ab394e4599 is described below

commit 2ab394e459949158393a2c71c50940819df48c55
Author: amory <[email protected]>
AuthorDate: Sat Oct 11 11:35:52 2025 +0800

    branch-3.1: [fix](collect_list) fix collect_list in multi BE will ser/de 
failed #48314 (#56752)
    
    picked from #48314
---
 .../aggregate_function_collect.h                   |  27 +-
 .../vec/aggregate_functions/agg_collect_test.cpp   |  45 +-
 .../data/query_p0/aggregate/array_agg.out          | 624 +++++++++++++++++++++
 .../suites/query_p0/aggregate/array_agg.groovy     |  14 +
 4 files changed, 701 insertions(+), 9 deletions(-)

diff --git a/be/src/vec/aggregate_functions/aggregate_function_collect.h 
b/be/src/vec/aggregate_functions/aggregate_function_collect.h
index 08a1f751206..a67aa18b504 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_collect.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_collect.h
@@ -312,6 +312,7 @@ template <typename HasLimit>
 struct AggregateFunctionCollectListData<void, HasLimit> {
     using ElementType = StringRef;
     using Self = AggregateFunctionCollectListData<void, HasLimit>;
+    DataTypeSerDeSPtr serde; // for complex serialize && deserialize from 
multi BE
     MutableColumnPtr column_data;
     Int64 max_size = -1;
 
@@ -319,6 +320,7 @@ struct AggregateFunctionCollectListData<void, HasLimit> {
     AggregateFunctionCollectListData(const DataTypes& argument_types) {
         DataTypePtr column_type = argument_types[0];
         column_data = column_type->create_column();
+        serde = column_type->get_serde();
     }
 
     size_t size() const { return column_data->size(); }
@@ -345,21 +347,41 @@ struct AggregateFunctionCollectListData<void, HasLimit> {
     void write(BufferWritable& buf) const {
         const size_t size = column_data->size();
         write_binary(size, buf);
+
+        DataTypeSerDe::FormatOptions opt;
+        auto tmp_str = ColumnString::create();
+        VectorBufferWriter tmp_buf(*tmp_str.get());
+
         for (size_t i = 0; i < size; i++) {
-            write_string_binary(column_data->get_data_at(i), buf);
+            tmp_str->clear();
+            if (Status st = serde->serialize_one_cell_to_json(*column_data, i, 
tmp_buf, opt); !st) {
+                throw doris::Exception(ErrorCode::INTERNAL_ERROR,
+                                       "Failed to serialize data for " + 
column_data->get_name() +
+                                               " error: " + st.to_string());
+            }
+            tmp_buf.commit();
+            write_string_binary(tmp_str->get_data_at(0), buf);
         }
+
         write_var_int(max_size, buf);
     }
 
     void read(BufferReadable& buf) {
         size_t size = 0;
         read_binary(size, buf);
+        column_data->clear();
         column_data->reserve(size);
 
         StringRef s;
+        DataTypeSerDe::FormatOptions opt;
         for (size_t i = 0; i < size; i++) {
             read_string_binary(s, buf);
-            column_data->insert_data(s.data, s.size);
+            Slice slice(s.data, s.size);
+            if (Status st = 
serde->deserialize_one_cell_from_json(*column_data, slice, opt); !st) {
+                throw doris::Exception(ErrorCode::INTERNAL_ERROR,
+                                       "Failed to deserialize data for " + 
column_data->get_name() +
+                                               " error: " + st.to_string());
+            }
         }
         read_var_int(max_size, buf);
     }
@@ -613,7 +635,6 @@ struct AggregateFunctionArrayAggData<void> {
         size_t size = 0;
         read_binary(size, buf);
         column_data->reserve(size);
-
         StringRef s;
         for (size_t i = 0; i < size; i++) {
             read_string_binary(s, buf);
diff --git a/be/test/vec/aggregate_functions/agg_collect_test.cpp 
b/be/test/vec/aggregate_functions/agg_collect_test.cpp
index eb9cb647ed4..9c6a0220894 100644
--- a/be/test/vec/aggregate_functions/agg_collect_test.cpp
+++ b/be/test/vec/aggregate_functions/agg_collect_test.cpp
@@ -63,12 +63,29 @@ public:
 
     template <typename DataType>
     void agg_collect_add_elements(AggregateFunctionPtr agg_function, 
AggregateDataPtr place,
-                                  size_t input_nums) {
+                                  size_t input_nums, bool support_complex = 
false) {
         using FieldType = typename DataType::FieldType;
-        auto type = std::make_shared<DataType>();
-        auto input_col = type->create_column();
+        MutableColumnPtr input_col;
+        if (support_complex) {
+            auto type =
+                    
std::make_shared<DataTypeArray>(make_nullable(std::make_shared<DataType>()));
+            input_col = type->create_column();
+        } else {
+            auto type = std::make_shared<DataType>();
+            input_col = type->create_column();
+        }
         for (size_t i = 0; i < input_nums; ++i) {
             for (size_t j = 0; j < _repeated_times; ++j) {
+                if (support_complex) {
+                    if constexpr (std::is_same_v<DataType, DataTypeString>) {
+                        Array vec1 = {Field(String("item0" + 
std::to_string(i))),
+                                      Field(String("item1" + 
std::to_string(i)))};
+                        input_col->insert(vec1);
+                    } else {
+                        input_col->insert_default();
+                    }
+                    continue;
+                }
                 if constexpr (std::is_same_v<DataType, DataTypeString>) {
                     auto item = std::string("item") + std::to_string(i);
                     input_col->insert_data(item.c_str(), item.size());
@@ -87,8 +104,13 @@ public:
     }
 
     template <typename DataType>
-    void test_agg_collect(const std::string& fn_name, size_t input_nums = 0) {
+    void test_agg_collect(const std::string& fn_name, size_t input_nums = 0,
+                          bool support_complex = false) {
         DataTypes data_types = {(DataTypePtr)std::make_shared<DataType>()};
+        if (support_complex) {
+            data_types = {
+                    
(DataTypePtr)std::make_shared<DataTypeArray>(make_nullable(data_types[0]))};
+        }
         LOG(INFO) << "test_agg_collect for " << fn_name << "(" << 
data_types[0]->get_name() << ")";
         AggregateFunctionSimpleFactory factory = 
AggregateFunctionSimpleFactory::instance();
         auto agg_function = factory.get(fn_name, data_types, false, -1);
@@ -98,7 +120,7 @@ public:
         AggregateDataPtr place = memory.get();
         agg_function->create(place);
 
-        agg_collect_add_elements<DataType>(agg_function, place, input_nums);
+        agg_collect_add_elements<DataType>(agg_function, place, input_nums, 
support_complex);
 
         ColumnString buf;
         VectorBufferWriter buf_writer(buf);
@@ -111,7 +133,7 @@ public:
         AggregateDataPtr place2 = memory2.get();
         agg_function->create(place2);
 
-        agg_collect_add_elements<DataType>(agg_function, place2, input_nums);
+        agg_collect_add_elements<DataType>(agg_function, place2, input_nums, 
support_complex);
 
         agg_function->merge(place, place2, &_agg_arena_pool);
         auto column_result = 
ColumnArray::create(data_types[0]->create_column());
@@ -173,4 +195,15 @@ TEST_F(VAggCollectTest, test_with_data) {
     test_agg_collect<DataTypeString>("collect_set", 5);
 }
 
+TEST_F(VAggCollectTest, test_complex_data_type) {
+    test_agg_collect<DataTypeInt8>("collect_list", 7, true);
+    test_agg_collect<DataTypeInt128>("array_agg", 9, true);
+
+    test_agg_collect<DataTypeDateTime>("collect_list", 5, true);
+    test_agg_collect<DataTypeDateTime>("array_agg", 6, true);
+
+    test_agg_collect<DataTypeString>("collect_list", 10, true);
+    test_agg_collect<DataTypeString>("array_agg", 5, true);
+}
+
 } // namespace doris::vectorized
diff --git a/regression-test/data/query_p0/aggregate/array_agg.out 
b/regression-test/data/query_p0/aggregate/array_agg.out
index 13e991205d7..c20e7ce9623 100644
--- a/regression-test/data/query_p0/aggregate/array_agg.out
+++ b/regression-test/data/query_p0/aggregate/array_agg.out
@@ -1031,6 +1031,630 @@
 [{"id":null}, {"id":4}, {"id":4}, {"id":4}]
 [{"id":null}, {"id":null}, {"id":null}, {"id":7}]
 
+-- !sql_collect_list_array1 --
+1      [["plum", "banana", "apple"], ["grape", "banana", null, "plum", 
"cherry"], ["apple", "banana", "kiwi", null], ["apple", "banana", "cherry", 
"kiwi", null], ["cherry", null]]
+10     [["apple", "banana", null, "cherry", "grape"], ["cherry", "berry", 
null], ["peach"]]
+11     [["grape", "apple", "kiwi"]]
+12     [["melon", "papaya", "kiwi"], ["plum", null, "kiwi", "banana"], 
["plum", null, "mango"], ["plum", null]]
+13     [["apple", null], ["peach", "cherry", "papaya", "kiwi", null], ["plum", 
null]]
+14     [["orange", "mango", "plum"], ["apple", "melon"], ["orange", "grape", 
null], ["orange", "banana", null]]
+15     [["banana", "peach", "plum", null], ["strawberry", null]]
+16     [["peach", "kiwi", null, "berry"], ["plum", "grape", null], ["kiwi", 
null]]
+17     [["banana", "plum", null], ["papaya"], ["apple", "kiwi", null, 
"papaya"]]
+18     [["apple", null], ["apple", "mango", null]]
+19     [["kiwi", "mango", null], ["pear", "grape"], ["cherry", null, "plum"], 
["banana", "mango", "cherry"]]
+2      [["apple", null, "banana"], ["orange", "grape", null]]
+20     [["grape", null], ["kiwi", null], ["kiwi", "plum", "orange", null], 
["papaya", "orange", "kiwi", null]]
+21     [["kiwi", null]]
+22     [["orange", "peach", null, "kiwi"]]
+23     [["berry", "grape", null]]
+24     []
+25     [["mango", "plum", "apple", null]]
+26     [["banana", null]]
+27     [["orange", "kiwi", "plum", null]]
+28     []
+29     [["apple", null, "grape", "peach"]]
+3      [["mango", null], ["orange"], ["apple", "kiwi", "papaya"], ["plum", 
"peach", null]]
+30     [["kiwi", "banana", null]]
+31     [["cherry", "berry", null, "plum"]]
+32     []
+33     [["apple", null, "kiwi", "orange"]]
+34     [["grape", "plum", null]]
+35     [["banana", null]]
+36     [["kiwi", "orange", "plum", null]]
+37     []
+38     [["apple", null]]
+39     [["plum", "grape", null]]
+4      [["mango", null, "orange", "plum", "berry", "kiwi"], ["orange", 
"grape", "mango", "berry"], ["plum", "kiwi", null, "peach", "berry"]]
+40     [["banana", "kiwi", "peach", null]]
+41     [["grape", null, "plum"]]
+42     [["orange", "kiwi", "peach", null]]
+43     []
+44     [["apple", "banana", null]]
+45     [["grape", null]]
+46     [["plum", "kiwi", null, "orange"]]
+47     []
+48     [["mango", null]]
+49     [["kiwi", "plum", "banana", null]]
+5      [["peach", "melon", null], ["apple", null, "kiwi"], ["grape", "kiwi", 
null]]
+50     []
+6      [["cherry", "apple", null, "plum"]]
+7      [["papaya", "cherry", "apple", null], ["melon"], ["melon", null, 
"papaya", "grape", "kiwi", "berry", null], ["orange", "grape", "kiwi"]]
+8      [["plum", "peach", null, "orange"], ["banana", null], ["berry", 
"cherry"], ["banana", "mango", null]]
+9      [["orange", "kiwi", "berry", null, "plum"], ["apple", "kiwi", "plum", 
null, "mango"], ["kiwi", null]]
+
+-- !sql_collect_list_map1 --
+1      [{"key5":null}, {"key2":15, "key3":8}, {"key1":10, "key2":5}, 
{"key1":10, "key2":20}, {"key2":null}]
+10     [{"key3":5, "key4":null}, {"key1":null, "key6":9}, {"key2":10, 
"key7":null}, {"key1":10}]
+11     [{"key1":9}, {"key4":5, "key5":null}, {"key1":3, "key5":null}, 
{"key4":null}]
+12     [{"key4":25}, {"key2":20, "key3":null}, {"key1":null, "key2":5}]
+13     [{"key2":null, "key3":7}, {"key3":null, "key5":10}]
+14     [{"key6":5}, {"key5":15, "key6":25}, {"key1":3, "key6":8}, {"key4":3, 
"key5":null}]
+15     [{"key1":18, "key6":22}, {"key2":4}, {"key3":null}]
+16     [{"key2":20}, {"key2":2}, {"key2":8, "key3":null}, {"key7":7, 
"key3":null}]
+17     [{"key4":8}, {"key6":9, "key7":null}, {"key1":10, "key4":14}, 
{"key7":null}]
+18     [{"key1":11}, {"key1":10, "key2":null}, {"key2":2}, {"key2":null, 
"key5":10}]
+19     [{"key7":9}, {"key1":1, "key2":2, "key3":3}, {"key1":null, "key7":6}, 
{"key3":7, "key4":null}]
+2      [{"key1":null, "key5":25}, {"key1":10, "key2":null, "key3":20}, 
{"key2":null, "key3":7}, {"key3":null}]
+20     [{"key1":null, "key3":6}, {"key1":1, "key9":6}, {"key1":14}, {"key5":3, 
"key7":null}]
+21     [{"key1":10, "key6":2}]
+22     [{"key3":null}]
+23     [{"key1":8}]
+24     [{"key2":15, "key4":null}]
+25     [{"key7":18}]
+26     [{"key3":12}]
+27     [{"key5":10}]
+28     [{"key1":14}]
+29     [{"key2":4, "key4":null}]
+3      [{"key1":12}, {"key1":5}, {"key3":null}, {"key1":5, "key4":null}]
+30     [{"key6":6}]
+31     [{"key3":null}]
+32     [{"key2":9, "key7":null}]
+33     [{"key1":7}]
+34     [{"key4":20}]
+35     [{"key1":12, "key5":null}]
+36     [{"key3":11}]
+37     [{"key1":null}]
+38     [{"key2":3, "key6":9}]
+39     [{"key5":8}]
+4      [{"key2":30}, {"key4":15}, {"key3":7, "key4":null}]
+40     [{"key1":15}]
+41     [{"key3":7}]
+42     [{"key4":5}]
+43     [{"key1":2, "key7":null}]
+44     [{"key2":14}]
+45     [{"key4":12}]
+46     [{"key6":10}]
+47     [{"key2":null}]
+48     [{"key5":9}]
+49     [{"key1":13}]
+5      [{"key1":10}, {"key1":7, "key2":8}, {"key2":8, "key5":null}]
+50     [{"key7":8}]
+6      [{"key4":7, "key6":null}, {"key1":1, "key2":2, "key3":null, "key4":4}, 
{"key3":null, "key6":12}, {"key2":null, "key3":25}]
+7      [{"key1":12, "key3":6}, {"key4":15, "key5":null}, {"key1":5}]
+8      [{"key1":6, "key7":12}, {"key2":9}, {"key1":null, "key5":50}]
+9      [{"key2":null, "key5":40}, {"key2":14, "key5":7}, {"key1":10, 
"key2":20, "key3":30, "key4":40, "key5":50, "key6":60, "key7":null}]
+
+-- !sql_collect_list_struct1 --
+1      [{"id":1}, {"id":1}, {"id":1}, {"id":1}, {"id":1}]
+10     [{"id":10}, {"id":10}, {"id":10}, {"id":null}]
+11     [{"id":11}, {"id":11}, {"id":11}, {"id":null}]
+12     [{"id":12}, {"id":12}, {"id":12}, {"id":null}]
+13     [{"id":13}, {"id":13}, {"id":13}, {"id":null}]
+14     [{"id":14}, {"id":null}, {"id":14}, {"id":null}]
+15     [{"id":15}, {"id":null}, {"id":15}, {"id":null}]
+16     [{"id":16}, {"id":16}, {"id":16}, {"id":16}]
+17     [{"id":17}, {"id":17}, {"id":17}, {"id":17}]
+18     [{"id":18}, {"id":null}, {"id":18}, {"id":18}]
+19     [{"id":19}, {"id":null}, {"id":19}, {"id":19}]
+2      [{"id":2}, {"id":null}, {"id":2}, {"id":2}]
+20     [{"id":20}, {"id":20}, {"id":null}, {"id":null}]
+21     [{"id":21}]
+22     [{"id":22}]
+23     [{"id":23}]
+24     [{"id":24}]
+25     [{"id":25}]
+26     [{"id":26}]
+27     [{"id":27}]
+28     [{"id":28}]
+29     [{"id":29}]
+3      [{"id":3}, {"id":3}, {"id":3}, {"id":3}]
+30     [{"id":30}]
+31     [{"id":31}]
+32     [{"id":32}]
+33     [{"id":33}]
+34     [{"id":34}]
+35     [{"id":35}]
+36     [{"id":36}]
+37     [{"id":37}]
+38     [{"id":38}]
+39     [{"id":39}]
+4      [{"id":null}, {"id":4}, {"id":4}, {"id":4}]
+40     [{"id":40}]
+41     [{"id":41}]
+42     [{"id":42}]
+43     [{"id":43}]
+44     [{"id":44}]
+45     [{"id":45}]
+46     [{"id":46}]
+47     [{"id":47}]
+48     [{"id":48}]
+49     [{"id":49}]
+5      [{"id":5}, {"id":null}, {"id":5}, {"id":5}]
+50     [{"id":50}]
+6      [{"id":6}, {"id":6}, {"id":6}, {"id":6}]
+7      [{"id":null}, {"id":null}, {"id":null}, {"id":7}]
+8      [{"id":8}, {"id":8}, {"id":8}, {"id":8}]
+9      [{"id":9}, {"id":9}, {"id":9}, {"id":9}]
+
+-- !sql_group_array_array1 --
+[["apple", "banana", null, "cherry", "grape"], ["cherry", "berry", null], 
["peach"]]
+[["apple", "banana", null]]
+[["apple", null, "banana"], ["orange", "grape", null]]
+[["apple", null, "grape", "peach"]]
+[["apple", null, "kiwi", "orange"]]
+[["apple", null], ["apple", "mango", null]]
+[["apple", null], ["peach", "cherry", "papaya", "kiwi", null], ["plum", null]]
+[["apple", null]]
+[["banana", "kiwi", "peach", null]]
+[["banana", "peach", "plum", null], ["strawberry", null]]
+[["banana", "plum", null], ["papaya"], ["apple", "kiwi", null, "papaya"]]
+[["banana", null]]
+[["banana", null]]
+[["berry", "grape", null]]
+[["cherry", "apple", null, "plum"]]
+[["cherry", "berry", null, "plum"]]
+[["grape", "apple", "kiwi"]]
+[["grape", "plum", null]]
+[["grape", null, "plum"]]
+[["grape", null], ["kiwi", null], ["kiwi", "plum", "orange", null], ["papaya", 
"orange", "kiwi", null]]
+[["grape", null]]
+[["kiwi", "banana", null]]
+[["kiwi", "mango", null], ["pear", "grape"], ["cherry", null, "plum"], 
["banana", "mango", "cherry"]]
+[["kiwi", "orange", "plum", null]]
+[["kiwi", "plum", "banana", null]]
+[["kiwi", null]]
+[["mango", "plum", "apple", null]]
+[["mango", null, "orange", "plum", "berry", "kiwi"], ["orange", "grape", 
"mango", "berry"], ["plum", "kiwi", null, "peach", "berry"]]
+[["mango", null], ["orange"], ["apple", "kiwi", "papaya"], ["plum", "peach", 
null]]
+[["mango", null]]
+[["melon", "papaya", "kiwi"], ["plum", null, "kiwi", "banana"], ["plum", null, 
"mango"], ["plum", null]]
+[["orange", "kiwi", "berry", null, "plum"], ["apple", "kiwi", "plum", null, 
"mango"], ["kiwi", null]]
+[["orange", "kiwi", "peach", null]]
+[["orange", "kiwi", "plum", null]]
+[["orange", "mango", "plum"], ["apple", "melon"], ["orange", "grape", null], 
["orange", "banana", null]]
+[["orange", "peach", null, "kiwi"]]
+[["papaya", "cherry", "apple", null], ["melon"], ["melon", null, "papaya", 
"grape", "kiwi", "berry", null], ["orange", "grape", "kiwi"]]
+[["peach", "kiwi", null, "berry"], ["plum", "grape", null], ["kiwi", null]]
+[["peach", "melon", null], ["apple", null, "kiwi"], ["grape", "kiwi", null]]
+[["plum", "banana", "apple"], ["grape", "banana", null, "plum", "cherry"], 
["apple", "banana", "kiwi", null], ["apple", "banana", "cherry", "kiwi", null], 
["cherry", null]]
+[["plum", "grape", null]]
+[["plum", "kiwi", null, "orange"]]
+[["plum", "peach", null, "orange"], ["banana", null], ["berry", "cherry"], 
["banana", "mango", null]]
+[]
+[]
+[]
+[]
+[]
+[]
+[]
+
+-- !sql_group_array_map1 --
+[{"key1":10, "key6":2}]
+[{"key1":10}, {"key1":7, "key2":8}, {"key2":8, "key5":null}]
+[{"key1":11}, {"key1":10, "key2":null}, {"key2":2}, {"key2":null, "key5":10}]
+[{"key1":12, "key3":6}, {"key4":15, "key5":null}, {"key1":5}]
+[{"key1":12, "key5":null}]
+[{"key1":12}, {"key1":5}, {"key3":null}, {"key1":5, "key4":null}]
+[{"key1":13}]
+[{"key1":14}]
+[{"key1":15}]
+[{"key1":18, "key6":22}, {"key2":4}, {"key3":null}]
+[{"key1":2, "key7":null}]
+[{"key1":6, "key7":12}, {"key2":9}, {"key1":null, "key5":50}]
+[{"key1":7}]
+[{"key1":8}]
+[{"key1":9}, {"key4":5, "key5":null}, {"key1":3, "key5":null}, {"key4":null}]
+[{"key1":null, "key3":6}, {"key1":1, "key9":6}, {"key1":14}, {"key5":3, 
"key7":null}]
+[{"key1":null, "key5":25}, {"key1":10, "key2":null, "key3":20}, {"key2":null, 
"key3":7}, {"key3":null}]
+[{"key1":null}]
+[{"key2":14}]
+[{"key2":15, "key4":null}]
+[{"key2":20}, {"key2":2}, {"key2":8, "key3":null}, {"key7":7, "key3":null}]
+[{"key2":3, "key6":9}]
+[{"key2":30}, {"key4":15}, {"key3":7, "key4":null}]
+[{"key2":4, "key4":null}]
+[{"key2":9, "key7":null}]
+[{"key2":null, "key3":7}, {"key3":null, "key5":10}]
+[{"key2":null, "key5":40}, {"key2":14, "key5":7}, {"key1":10, "key2":20, 
"key3":30, "key4":40, "key5":50, "key6":60, "key7":null}]
+[{"key2":null}]
+[{"key3":11}]
+[{"key3":12}]
+[{"key3":5, "key4":null}, {"key1":null, "key6":9}, {"key2":10, "key7":null}, 
{"key1":10}]
+[{"key3":7}]
+[{"key3":null}]
+[{"key3":null}]
+[{"key4":12}]
+[{"key4":20}]
+[{"key4":25}, {"key2":20, "key3":null}, {"key1":null, "key2":5}]
+[{"key4":5}]
+[{"key4":7, "key6":null}, {"key1":1, "key2":2, "key3":null, "key4":4}, 
{"key3":null, "key6":12}, {"key2":null, "key3":25}]
+[{"key4":8}, {"key6":9, "key7":null}, {"key1":10, "key4":14}, {"key7":null}]
+[{"key5":10}]
+[{"key5":8}]
+[{"key5":9}]
+[{"key5":null}, {"key2":15, "key3":8}, {"key1":10, "key2":5}, {"key1":10, 
"key2":20}, {"key2":null}]
+[{"key6":10}]
+[{"key6":5}, {"key5":15, "key6":25}, {"key1":3, "key6":8}, {"key4":3, 
"key5":null}]
+[{"key6":6}]
+[{"key7":18}]
+[{"key7":8}]
+[{"key7":9}, {"key1":1, "key2":2, "key3":3}, {"key1":null, "key7":6}, 
{"key3":7, "key4":null}]
+
+-- !sql_group_array_struct1 --
+[{"id":10}, {"id":10}, {"id":10}, {"id":null}]
+[{"id":11}, {"id":11}, {"id":11}, {"id":null}]
+[{"id":12}, {"id":12}, {"id":12}, {"id":null}]
+[{"id":13}, {"id":13}, {"id":13}, {"id":null}]
+[{"id":14}, {"id":null}, {"id":14}, {"id":null}]
+[{"id":15}, {"id":null}, {"id":15}, {"id":null}]
+[{"id":16}, {"id":16}, {"id":16}, {"id":16}]
+[{"id":17}, {"id":17}, {"id":17}, {"id":17}]
+[{"id":18}, {"id":null}, {"id":18}, {"id":18}]
+[{"id":19}, {"id":null}, {"id":19}, {"id":19}]
+[{"id":1}, {"id":1}, {"id":1}, {"id":1}, {"id":1}]
+[{"id":20}, {"id":20}, {"id":null}, {"id":null}]
+[{"id":21}]
+[{"id":22}]
+[{"id":23}]
+[{"id":24}]
+[{"id":25}]
+[{"id":26}]
+[{"id":27}]
+[{"id":28}]
+[{"id":29}]
+[{"id":2}, {"id":null}, {"id":2}, {"id":2}]
+[{"id":30}]
+[{"id":31}]
+[{"id":32}]
+[{"id":33}]
+[{"id":34}]
+[{"id":35}]
+[{"id":36}]
+[{"id":37}]
+[{"id":38}]
+[{"id":39}]
+[{"id":3}, {"id":3}, {"id":3}, {"id":3}]
+[{"id":40}]
+[{"id":41}]
+[{"id":42}]
+[{"id":43}]
+[{"id":44}]
+[{"id":45}]
+[{"id":46}]
+[{"id":47}]
+[{"id":48}]
+[{"id":49}]
+[{"id":50}]
+[{"id":5}, {"id":null}, {"id":5}, {"id":5}]
+[{"id":6}, {"id":6}, {"id":6}, {"id":6}]
+[{"id":8}, {"id":8}, {"id":8}, {"id":8}]
+[{"id":9}, {"id":9}, {"id":9}, {"id":9}]
+[{"id":null}, {"id":4}, {"id":4}, {"id":4}]
+[{"id":null}, {"id":null}, {"id":null}, {"id":7}]
+
+-- !sql_collect_list_array_limit1 --
+1      [["plum", "banana", "apple"], ["grape", "banana", null, "plum", 
"cherry"]]
+10     [["apple", "banana", null, "cherry", "grape"], ["cherry", "berry", 
null]]
+11     [["grape", "apple", "kiwi"]]
+12     [["melon", "papaya", "kiwi"], ["plum", null, "kiwi", "banana"]]
+13     [["apple", null], ["peach", "cherry", "papaya", "kiwi", null]]
+14     [["orange", "mango", "plum"], ["apple", "melon"]]
+15     [["banana", "peach", "plum", null], ["strawberry", null]]
+16     [["peach", "kiwi", null, "berry"], ["plum", "grape", null]]
+17     [["banana", "plum", null], ["papaya"]]
+18     [["apple", null], ["apple", "mango", null]]
+19     [["kiwi", "mango", null], ["pear", "grape"]]
+2      [["apple", null, "banana"], ["orange", "grape", null]]
+20     [["grape", null], ["kiwi", null]]
+21     [["kiwi", null]]
+22     [["orange", "peach", null, "kiwi"]]
+23     [["berry", "grape", null]]
+24     []
+25     [["mango", "plum", "apple", null]]
+26     [["banana", null]]
+27     [["orange", "kiwi", "plum", null]]
+28     []
+29     [["apple", null, "grape", "peach"]]
+3      [["mango", null], ["orange"]]
+30     [["kiwi", "banana", null]]
+31     [["cherry", "berry", null, "plum"]]
+32     []
+33     [["apple", null, "kiwi", "orange"]]
+34     [["grape", "plum", null]]
+35     [["banana", null]]
+36     [["kiwi", "orange", "plum", null]]
+37     []
+38     [["apple", null]]
+39     [["plum", "grape", null]]
+4      [["mango", null, "orange", "plum", "berry", "kiwi"], ["orange", 
"grape", "mango", "berry"]]
+40     [["banana", "kiwi", "peach", null]]
+41     [["grape", null, "plum"]]
+42     [["orange", "kiwi", "peach", null]]
+43     []
+44     [["apple", "banana", null]]
+45     [["grape", null]]
+46     [["plum", "kiwi", null, "orange"]]
+47     []
+48     [["mango", null]]
+49     [["kiwi", "plum", "banana", null]]
+5      [["peach", "melon", null], ["apple", null, "kiwi"]]
+50     []
+6      [["cherry", "apple", null, "plum"]]
+7      [["papaya", "cherry", "apple", null], ["melon"]]
+8      [["plum", "peach", null, "orange"], ["banana", null]]
+9      [["orange", "kiwi", "berry", null, "plum"], ["apple", "kiwi", "plum", 
null, "mango"]]
+
+-- !sql_collect_list_map_limit1 --
+1      [{"key5":null}, {"key2":15, "key3":8}]
+10     [{"key3":5, "key4":null}, {"key1":null, "key6":9}]
+11     [{"key1":9}, {"key4":5, "key5":null}]
+12     [{"key4":25}, {"key2":20, "key3":null}]
+13     [{"key2":null, "key3":7}, {"key3":null, "key5":10}]
+14     [{"key6":5}, {"key5":15, "key6":25}]
+15     [{"key1":18, "key6":22}, {"key2":4}]
+16     [{"key2":20}, {"key2":2}]
+17     [{"key4":8}, {"key6":9, "key7":null}]
+18     [{"key1":11}, {"key1":10, "key2":null}]
+19     [{"key7":9}, {"key1":1, "key2":2, "key3":3}]
+2      [{"key1":null, "key5":25}, {"key1":10, "key2":null, "key3":20}]
+20     [{"key1":null, "key3":6}, {"key1":1, "key9":6}]
+21     [{"key1":10, "key6":2}]
+22     [{"key3":null}]
+23     [{"key1":8}]
+24     [{"key2":15, "key4":null}]
+25     [{"key7":18}]
+26     [{"key3":12}]
+27     [{"key5":10}]
+28     [{"key1":14}]
+29     [{"key2":4, "key4":null}]
+3      [{"key1":12}, {"key1":5}]
+30     [{"key6":6}]
+31     [{"key3":null}]
+32     [{"key2":9, "key7":null}]
+33     [{"key1":7}]
+34     [{"key4":20}]
+35     [{"key1":12, "key5":null}]
+36     [{"key3":11}]
+37     [{"key1":null}]
+38     [{"key2":3, "key6":9}]
+39     [{"key5":8}]
+4      [{"key2":30}, {"key4":15}]
+40     [{"key1":15}]
+41     [{"key3":7}]
+42     [{"key4":5}]
+43     [{"key1":2, "key7":null}]
+44     [{"key2":14}]
+45     [{"key4":12}]
+46     [{"key6":10}]
+47     [{"key2":null}]
+48     [{"key5":9}]
+49     [{"key1":13}]
+5      [{"key1":10}, {"key1":7, "key2":8}]
+50     [{"key7":8}]
+6      [{"key4":7, "key6":null}, {"key1":1, "key2":2, "key3":null, "key4":4}]
+7      [{"key1":12, "key3":6}, {"key4":15, "key5":null}]
+8      [{"key1":6, "key7":12}, {"key2":9}]
+9      [{"key2":null, "key5":40}, {"key2":14, "key5":7}]
+
+-- !sql_collect_list_struct_limit1 --
+1      [{"id":1}, {"id":1}, {"id":1}]
+10     [{"id":10}, {"id":10}, {"id":10}]
+11     [{"id":11}, {"id":11}, {"id":11}]
+12     [{"id":12}, {"id":12}, {"id":12}]
+13     [{"id":13}, {"id":13}, {"id":13}]
+14     [{"id":14}, {"id":null}, {"id":14}]
+15     [{"id":15}, {"id":null}, {"id":15}]
+16     [{"id":16}, {"id":16}, {"id":16}]
+17     [{"id":17}, {"id":17}, {"id":17}]
+18     [{"id":18}, {"id":null}, {"id":18}]
+19     [{"id":19}, {"id":null}, {"id":19}]
+2      [{"id":2}, {"id":null}, {"id":2}]
+20     [{"id":20}, {"id":20}, {"id":null}]
+21     [{"id":21}]
+22     [{"id":22}]
+23     [{"id":23}]
+24     [{"id":24}]
+25     [{"id":25}]
+26     [{"id":26}]
+27     [{"id":27}]
+28     [{"id":28}]
+29     [{"id":29}]
+3      [{"id":3}, {"id":3}, {"id":3}]
+30     [{"id":30}]
+31     [{"id":31}]
+32     [{"id":32}]
+33     [{"id":33}]
+34     [{"id":34}]
+35     [{"id":35}]
+36     [{"id":36}]
+37     [{"id":37}]
+38     [{"id":38}]
+39     [{"id":39}]
+4      [{"id":null}, {"id":4}, {"id":4}]
+40     [{"id":40}]
+41     [{"id":41}]
+42     [{"id":42}]
+43     [{"id":43}]
+44     [{"id":44}]
+45     [{"id":45}]
+46     [{"id":46}]
+47     [{"id":47}]
+48     [{"id":48}]
+49     [{"id":49}]
+5      [{"id":5}, {"id":null}, {"id":5}]
+50     [{"id":50}]
+6      [{"id":6}, {"id":6}, {"id":6}]
+7      [{"id":null}, {"id":null}, {"id":null}]
+8      [{"id":8}, {"id":8}, {"id":8}]
+9      [{"id":9}, {"id":9}, {"id":9}]
+
+-- !sql_group_array_array_limit1 --
+[["apple", "banana", null, "cherry", "grape"], ["cherry", "berry", null], 
["peach"]]
+[["apple", "banana", null]]
+[["apple", null, "banana"], ["orange", "grape", null]]
+[["apple", null, "grape", "peach"]]
+[["apple", null, "kiwi", "orange"]]
+[["apple", null], ["apple", "mango", null]]
+[["apple", null], ["peach", "cherry", "papaya", "kiwi", null], ["plum", null]]
+[["apple", null]]
+[["banana", "kiwi", "peach", null]]
+[["banana", "peach", "plum", null], ["strawberry", null]]
+[["banana", "plum", null], ["papaya"], ["apple", "kiwi", null, "papaya"]]
+[["banana", null]]
+[["banana", null]]
+[["berry", "grape", null]]
+[["cherry", "apple", null, "plum"]]
+[["cherry", "berry", null, "plum"]]
+[["grape", "apple", "kiwi"]]
+[["grape", "plum", null]]
+[["grape", null, "plum"]]
+[["grape", null], ["kiwi", null], ["kiwi", "plum", "orange", null]]
+[["grape", null]]
+[["kiwi", "banana", null]]
+[["kiwi", "mango", null], ["pear", "grape"], ["cherry", null, "plum"]]
+[["kiwi", "orange", "plum", null]]
+[["kiwi", "plum", "banana", null]]
+[["kiwi", null]]
+[["mango", "plum", "apple", null]]
+[["mango", null, "orange", "plum", "berry", "kiwi"], ["orange", "grape", 
"mango", "berry"], ["plum", "kiwi", null, "peach", "berry"]]
+[["mango", null], ["orange"], ["apple", "kiwi", "papaya"]]
+[["mango", null]]
+[["melon", "papaya", "kiwi"], ["plum", null, "kiwi", "banana"], ["plum", null, 
"mango"]]
+[["orange", "kiwi", "berry", null, "plum"], ["apple", "kiwi", "plum", null, 
"mango"], ["kiwi", null]]
+[["orange", "kiwi", "peach", null]]
+[["orange", "kiwi", "plum", null]]
+[["orange", "mango", "plum"], ["apple", "melon"], ["orange", "grape", null]]
+[["orange", "peach", null, "kiwi"]]
+[["papaya", "cherry", "apple", null], ["melon"], ["melon", null, "papaya", 
"grape", "kiwi", "berry", null]]
+[["peach", "kiwi", null, "berry"], ["plum", "grape", null], ["kiwi", null]]
+[["peach", "melon", null], ["apple", null, "kiwi"], ["grape", "kiwi", null]]
+[["plum", "banana", "apple"], ["grape", "banana", null, "plum", "cherry"], 
["apple", "banana", "kiwi", null]]
+[["plum", "grape", null]]
+[["plum", "kiwi", null, "orange"]]
+[["plum", "peach", null, "orange"], ["banana", null], ["berry", "cherry"]]
+[]
+[]
+[]
+[]
+[]
+[]
+[]
+
+-- !sql_group_array_map_limit1 --
+[{"key1":10, "key6":2}]
+[{"key1":10}, {"key1":7, "key2":8}, {"key2":8, "key5":null}]
+[{"key1":11}, {"key1":10, "key2":null}, {"key2":2}, {"key2":null, "key5":10}]
+[{"key1":12, "key3":6}, {"key4":15, "key5":null}, {"key1":5}]
+[{"key1":12, "key5":null}]
+[{"key1":12}, {"key1":5}, {"key3":null}, {"key1":5, "key4":null}]
+[{"key1":13}]
+[{"key1":14}]
+[{"key1":15}]
+[{"key1":18, "key6":22}, {"key2":4}, {"key3":null}]
+[{"key1":2, "key7":null}]
+[{"key1":6, "key7":12}, {"key2":9}, {"key1":null, "key5":50}]
+[{"key1":7}]
+[{"key1":8}]
+[{"key1":9}, {"key4":5, "key5":null}, {"key1":3, "key5":null}, {"key4":null}]
+[{"key1":null, "key3":6}, {"key1":1, "key9":6}, {"key1":14}, {"key5":3, 
"key7":null}]
+[{"key1":null, "key5":25}, {"key1":10, "key2":null, "key3":20}, {"key2":null, 
"key3":7}, {"key3":null}]
+[{"key1":null}]
+[{"key2":14}]
+[{"key2":15, "key4":null}]
+[{"key2":20}, {"key2":2}, {"key2":8, "key3":null}, {"key7":7, "key3":null}]
+[{"key2":3, "key6":9}]
+[{"key2":30}, {"key4":15}, {"key3":7, "key4":null}]
+[{"key2":4, "key4":null}]
+[{"key2":9, "key7":null}]
+[{"key2":null, "key3":7}, {"key3":null, "key5":10}]
+[{"key2":null, "key5":40}, {"key2":14, "key5":7}, {"key1":10, "key2":20, 
"key3":30, "key4":40, "key5":50, "key6":60, "key7":null}]
+[{"key2":null}]
+[{"key3":11}]
+[{"key3":12}]
+[{"key3":5, "key4":null}, {"key1":null, "key6":9}, {"key2":10, "key7":null}, 
{"key1":10}]
+[{"key3":7}]
+[{"key3":null}]
+[{"key3":null}]
+[{"key4":12}]
+[{"key4":20}]
+[{"key4":25}, {"key2":20, "key3":null}, {"key1":null, "key2":5}]
+[{"key4":5}]
+[{"key4":7, "key6":null}, {"key1":1, "key2":2, "key3":null, "key4":4}, 
{"key3":null, "key6":12}, {"key2":null, "key3":25}]
+[{"key4":8}, {"key6":9, "key7":null}, {"key1":10, "key4":14}, {"key7":null}]
+[{"key5":10}]
+[{"key5":8}]
+[{"key5":9}]
+[{"key5":null}, {"key2":15, "key3":8}, {"key1":10, "key2":5}, {"key1":10, 
"key2":20}, {"key2":null}]
+[{"key6":10}]
+[{"key6":5}, {"key5":15, "key6":25}, {"key1":3, "key6":8}, {"key4":3, 
"key5":null}]
+[{"key6":6}]
+[{"key7":18}]
+[{"key7":8}]
+[{"key7":9}, {"key1":1, "key2":2, "key3":3}, {"key1":null, "key7":6}, 
{"key3":7, "key4":null}]
+
+-- !sql_group_array_struct_limit1 --
+[{"id":10}, {"id":10}, {"id":10}, {"id":null}]
+[{"id":11}, {"id":11}, {"id":11}, {"id":null}]
+[{"id":12}, {"id":12}, {"id":12}, {"id":null}]
+[{"id":13}, {"id":13}, {"id":13}, {"id":null}]
+[{"id":14}, {"id":null}, {"id":14}, {"id":null}]
+[{"id":15}, {"id":null}, {"id":15}, {"id":null}]
+[{"id":16}, {"id":16}, {"id":16}, {"id":16}]
+[{"id":17}, {"id":17}, {"id":17}, {"id":17}]
+[{"id":18}, {"id":null}, {"id":18}, {"id":18}]
+[{"id":19}, {"id":null}, {"id":19}, {"id":19}]
+[{"id":1}, {"id":1}, {"id":1}, {"id":1}, {"id":1}]
+[{"id":20}, {"id":20}, {"id":null}, {"id":null}]
+[{"id":21}]
+[{"id":22}]
+[{"id":23}]
+[{"id":24}]
+[{"id":25}]
+[{"id":26}]
+[{"id":27}]
+[{"id":28}]
+[{"id":29}]
+[{"id":2}, {"id":null}, {"id":2}, {"id":2}]
+[{"id":30}]
+[{"id":31}]
+[{"id":32}]
+[{"id":33}]
+[{"id":34}]
+[{"id":35}]
+[{"id":36}]
+[{"id":37}]
+[{"id":38}]
+[{"id":39}]
+[{"id":3}, {"id":3}, {"id":3}, {"id":3}]
+[{"id":40}]
+[{"id":41}]
+[{"id":42}]
+[{"id":43}]
+[{"id":44}]
+[{"id":45}]
+[{"id":46}]
+[{"id":47}]
+[{"id":48}]
+[{"id":49}]
+[{"id":50}]
+[{"id":5}, {"id":null}, {"id":5}, {"id":5}]
+[{"id":6}, {"id":6}, {"id":6}, {"id":6}]
+[{"id":8}, {"id":8}, {"id":8}, {"id":8}]
+[{"id":9}, {"id":9}, {"id":9}, {"id":9}]
+[{"id":null}, {"id":4}, {"id":4}, {"id":4}]
+[{"id":null}, {"id":null}, {"id":null}, {"id":7}]
+
 -- !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 83001b84151..2a3184746f1 100644
--- a/regression-test/suites/query_p0/aggregate/array_agg.groovy
+++ b/regression-test/suites/query_p0/aggregate/array_agg.groovy
@@ -293,6 +293,20 @@ suite("array_agg") {
     order_qt_sql_group_array_map_limit """ SELECT group_array(km, 7) FROM 
test_array_agg_complex GROUP BY id ORDER BY id"""
     order_qt_sql_group_array_struct_limit """ SELECT group_array(ks, 7) FROM 
test_array_agg_complex GROUP BY id ORDER BY id"""
 
+    // for session variable "set ENABLE_LOCAL_EXCHANGE = 0
+    order_qt_sql_collect_list_array1 """ SELECT /*+ SET ENABLE_LOCAL_EXCHANGE 
= 0 */ id, collect_list(kastr) FROM test_array_agg_complex GROUP BY id ORDER BY 
id """
+    order_qt_sql_collect_list_map1 """ SELECT /*+ SET ENABLE_LOCAL_EXCHANGE = 
0 */ id, collect_list(km) FROM test_array_agg_complex GROUP BY id ORDER BY id 
"""
+    order_qt_sql_collect_list_struct1 """ SELECT /*+ SET ENABLE_LOCAL_EXCHANGE 
= 0 */ id, collect_list(ks) FROM test_array_agg_complex GROUP BY id ORDER BY id 
"""
+    order_qt_sql_group_array_array1 """ SELECT /*+ SET ENABLE_LOCAL_EXCHANGE = 
0 */ group_array(kastr) FROM test_array_agg_complex GROUP BY id ORDER BY id """
+    order_qt_sql_group_array_map1 """ SELECT /*+ SET ENABLE_LOCAL_EXCHANGE = 0 
*/ group_array(km) FROM test_array_agg_complex GROUP BY id ORDER BY id """
+    order_qt_sql_group_array_struct1 """ SELECT /*+ SET ENABLE_LOCAL_EXCHANGE 
= 0 */ group_array(ks) FROM test_array_agg_complex GROUP BY id ORDER BY id """
+    // add limit for param
+    order_qt_sql_collect_list_array_limit1 """ SELECT /*+ SET 
ENABLE_LOCAL_EXCHANGE = 0 */ id, collect_list(kastr, 2) FROM 
test_array_agg_complex GROUP BY id ORDER BY id """
+    order_qt_sql_collect_list_map_limit1 """ SELECT /*+ SET 
ENABLE_LOCAL_EXCHANGE = 0 */ id, collect_list(km, 2) FROM 
test_array_agg_complex GROUP BY id ORDER BY id """
+    order_qt_sql_collect_list_struct_limit1 """ SELECT /*+ SET 
ENABLE_LOCAL_EXCHANGE = 0 */ id, collect_list(ks, 3) FROM 
test_array_agg_complex GROUP BY id ORDER BY id """
+    order_qt_sql_group_array_array_limit1 """ SELECT /*+ SET 
ENABLE_LOCAL_EXCHANGE = 0 */ group_array(kastr, 3) FROM test_array_agg_complex 
GROUP BY id ORDER BY id """
+    order_qt_sql_group_array_map_limit1 """ SELECT /*+ SET 
ENABLE_LOCAL_EXCHANGE = 0 */ group_array(km, 7) FROM test_array_agg_complex 
GROUP BY id ORDER BY id """
+    order_qt_sql_group_array_struct_limit1 """ SELECT /*+ SET 
ENABLE_LOCAL_EXCHANGE = 0 */ group_array(ks, 7) FROM test_array_agg_complex 
GROUP BY id ORDER BY id """
 
  sql """ DROP TABLE IF EXISTS test_array_agg_ip;"""
     sql """


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


Reply via email to