Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion be/src/vec/aggregate_functions/aggregate_function_collect.h
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,8 @@ class AggregateFunctionCollect
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

                auto& vec = col_null->get_nested_column();
                vec.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>(
Expand Down
4 changes: 4 additions & 0 deletions regression-test/data/query_p0/aggregate/array_agg.out
Original file line number Diff line number Diff line change
Expand Up @@ -1658,3 +1658,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"]

-- !select --
corp001 [["tag3"], ["tag1", "tag2"]]
corp002 [["tag4", "tag5"]]

52 changes: 41 additions & 11 deletions regression-test/suites/query_p0/aggregate/array_agg.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ suite("array_agg") {
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);
"""
"""

sql """
CREATE TABLE `test_array_agg_int` (
Expand All @@ -57,7 +57,7 @@ suite("array_agg") {
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);
"""
"""

sql """
CREATE TABLE `test_array_agg_decimal` (
Expand All @@ -78,7 +78,7 @@ suite("array_agg") {
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);
"""
"""

sql """
insert into `test_array_agg` values
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
"""
Expand Down Expand Up @@ -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"); """
Expand All @@ -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;"
}
Loading