mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 11:02:08 +00:00
Merge pull request #309 from ludv1x/METR-24025
Fixed segfault in aggregation combinators for complex nested functions
This commit is contained in:
commit
1d641212c8
@ -83,7 +83,7 @@ public:
|
||||
return nested_func->alignOfData();
|
||||
}
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena *) const override
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena * arena) const override
|
||||
{
|
||||
const IColumn * nested[num_agruments];
|
||||
|
||||
@ -97,7 +97,7 @@ public:
|
||||
size_t end = offsets[row_num];
|
||||
|
||||
for (size_t i = begin; i < end; ++i)
|
||||
nested_func->add(place, nested, i, nullptr);
|
||||
nested_func->add(place, nested, i, arena);
|
||||
}
|
||||
|
||||
void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs, Arena * arena) const override
|
||||
|
@ -77,10 +77,10 @@ public:
|
||||
return nested_func->alignOfData();
|
||||
}
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena *) const override
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena * arena) const override
|
||||
{
|
||||
if (static_cast<const ColumnUInt8 &>(*columns[num_agruments - 1]).getData()[row_num])
|
||||
nested_func->add(place, columns, row_num, nullptr);
|
||||
nested_func->add(place, columns, row_num, arena);
|
||||
}
|
||||
|
||||
void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs, Arena * arena) const override
|
||||
|
@ -0,0 +1,20 @@
|
||||
999
|
||||
999
|
||||
999
|
||||
999
|
||||
999
|
||||
999
|
||||
999
|
||||
999
|
||||
999
|
||||
999
|
||||
1000
|
||||
1000
|
||||
1000
|
||||
1000
|
||||
1000
|
||||
1000
|
||||
1000
|
||||
1000
|
||||
1000
|
||||
1000
|
@ -0,0 +1,6 @@
|
||||
DROP TABLE IF EXISTS test.arena;
|
||||
CREATE TABLE test.arena (k UInt8, d String) ENGINE = Memory;
|
||||
INSERT INTO test.arena SELECT number % 10 AS k, hex(intDiv(number, 10) % 1000) AS d FROM system.numbers LIMIT 10000000;
|
||||
SELECT length(groupUniqArrayIf(d, d != hex(0))) FROM test.arena GROUP BY k;
|
||||
SELECT length(groupUniqArrayMerge(ds)) FROM (SELECT k, groupUniqArrayState(d) AS ds FROM test.arena GROUP BY k) GROUP BY k;
|
||||
DROP TABLE IF EXISTS test.arena;
|
Loading…
Reference in New Issue
Block a user