Fix moving sum segfault

This commit is contained in:
alesapin 2020-08-04 22:45:39 +03:00
parent 61a8d9b137
commit 2ef491bc53
3 changed files with 9 additions and 6 deletions

View File

@ -154,12 +154,13 @@ public:
if (unlikely(size > AGGREGATE_FUNCTION_MOVING_MAX_ARRAY_SIZE))
throw Exception("Too large array size", ErrorCodes::TOO_LARGE_ARRAY_SIZE);
auto & value = this->data(place).value;
value.resize(size, arena);
buf.read(reinterpret_cast<char *>(value.data()), size * sizeof(value[0]));
this->data(place).sum = value.back();
if (size > 0)
{
auto & value = this->data(place).value;
value.resize(size, arena);
buf.read(reinterpret_cast<char *>(value.data()), size * sizeof(value[0]));
this->data(place).sum = value.back();
}
}
void insertResultInto(AggregateDataPtr place, IColumn & to, Arena *) const override

View File

@ -0,0 +1 @@
[]

View File

@ -0,0 +1 @@
SELECT groupArrayMovingSum(10)(0) FROM remote('127.0.0.{1,2}', numbers(0))