AggregateFunctionGroupArrayInsertAt: fixed error [#CLICKHOUSE-3003].

This commit is contained in:
Alexey Milovidov 2017-05-12 23:05:19 +03:00
parent 3819216085
commit 1d090bd4e2
3 changed files with 4 additions and 1 deletions

View File

@ -118,7 +118,7 @@ public:
if (arr_lhs.size() < arr_rhs.size())
arr_lhs.resize(arr_rhs.size());
for (size_t i = 0, size = arr_lhs.size(); i < size; ++i)
for (size_t i = 0, size = arr_rhs.size(); i < size; ++i)
if (arr_lhs[i].isNull() && !arr_rhs[i].isNull())
arr_lhs[i] = arr_rhs[i];
}
@ -128,6 +128,7 @@ public:
const Array & arr = data(place).value;
size_t size = arr.size();
writeVarUInt(size, buf);
for (const Field & elem : arr)
{
if (elem.isNull())

View File

@ -11,3 +11,4 @@
7 [0,0,0,0,0,0,0,7]
8 [0,0,0,0,0,0,0,0,8]
9 [0,0,0,0,0,0,0,0,0,9]
0 0

View File

@ -2,3 +2,4 @@ SELECT groupArrayInsertAt(toString(number), number * 2) FROM (SELECT * FROM syst
SELECT groupArrayInsertAt('-')(toString(number), number * 2) FROM (SELECT * FROM system.numbers LIMIT 10);
SELECT groupArrayInsertAt([123])(range(number), number * 2) FROM (SELECT * FROM system.numbers LIMIT 10);
SELECT number, groupArrayInsertAt(number, number) FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY number ORDER BY number;
SELECT k, ignore(groupArrayInsertAt(x, x)) FROM (SELECT dummy AS k, randConstant() % 10 AS x FROM remote('127.0.0.{1,1}', system.one)) GROUP BY k ORDER BY k;