From a54a63459560817ea2da787156b176c69c5f00dc Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Mon, 19 Jan 2015 22:51:46 +0300 Subject: [PATCH] dbms: fixed performance issue caused by typo [#METR-14654]. --- .../AggregateFunctions/AggregateFunctionGroupArray.h | 2 +- .../queries/0_stateless/00113_group_array.reference | 12 ++++++++++++ dbms/tests/queries/0_stateless/00113_group_array.sql | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 dbms/tests/queries/0_stateless/00113_group_array.reference create mode 100644 dbms/tests/queries/0_stateless/00113_group_array.sql diff --git a/dbms/include/DB/AggregateFunctions/AggregateFunctionGroupArray.h b/dbms/include/DB/AggregateFunctions/AggregateFunctionGroupArray.h index 987c20a4bef..5b9428af0b2 100644 --- a/dbms/include/DB/AggregateFunctions/AggregateFunctionGroupArray.h +++ b/dbms/include/DB/AggregateFunctions/AggregateFunctionGroupArray.h @@ -47,7 +47,7 @@ public: void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs) const { - data(place).value.insert(data(place).value.begin(), data(rhs).value.begin(), data(rhs).value.end()); + data(place).value.insert(data(place).value.end(), data(rhs).value.begin(), data(rhs).value.end()); } void serialize(ConstAggregateDataPtr place, WriteBuffer & buf) const diff --git a/dbms/tests/queries/0_stateless/00113_group_array.reference b/dbms/tests/queries/0_stateless/00113_group_array.reference new file mode 100644 index 00000000000..2b501e8d65a --- /dev/null +++ b/dbms/tests/queries/0_stateless/00113_group_array.reference @@ -0,0 +1,12 @@ +0 100 +1 100 +2 100 +3 100 +4 100 +5 100 +6 100 +7 100 +8 100 +9 100 + +0 1000000 diff --git a/dbms/tests/queries/0_stateless/00113_group_array.sql b/dbms/tests/queries/0_stateless/00113_group_array.sql new file mode 100644 index 00000000000..e9c2d0956ec --- /dev/null +++ b/dbms/tests/queries/0_stateless/00113_group_array.sql @@ -0,0 +1 @@ +SELECT intDiv(number, 100) AS k, length(groupArray(number)) FROM (SELECT * FROM system.numbers LIMIT 1000000) GROUP BY k WITH TOTALS ORDER BY k LIMIT 10;