mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Merge pull request #153 from ludv1x/METR-23285
Fixed segfaults in quantiles* functions with empty levels set.
This commit is contained in:
commit
77e3d75ca0
@ -233,6 +233,9 @@ public:
|
||||
size_t num_levels = levels.size();
|
||||
offsets_to.push_back((offsets_to.size() == 0 ? 0 : offsets_to.back()) + num_levels);
|
||||
|
||||
if (!num_levels)
|
||||
return;
|
||||
|
||||
typename ColumnVector<ValueType>::Container_t & data_to = static_cast<ColumnVector<ValueType> &>(arr_to.getData()).getData();
|
||||
|
||||
size_t old_size = data_to.size();
|
||||
|
@ -541,6 +541,9 @@ public:
|
||||
size_t size = levels.size();
|
||||
offsets_to.push_back((offsets_to.size() == 0 ? 0 : offsets_to.back()) + size);
|
||||
|
||||
if (!size)
|
||||
return;
|
||||
|
||||
if (returns_float)
|
||||
{
|
||||
typename ColumnFloat32::Container_t & data_to = static_cast<ColumnFloat32 &>(arr_to.getData()).getData();
|
||||
@ -623,6 +626,9 @@ public:
|
||||
size_t size = levels.size();
|
||||
offsets_to.push_back((offsets_to.size() == 0 ? 0 : offsets_to.back()) + size);
|
||||
|
||||
if (!size)
|
||||
return;
|
||||
|
||||
if (returns_float)
|
||||
{
|
||||
typename ColumnFloat32::Container_t & data_to = static_cast<ColumnFloat32 &>(arr_to.getData()).getData();
|
||||
|
@ -958,6 +958,9 @@ public:
|
||||
size_t size = levels.size();
|
||||
offsets_to.push_back((offsets_to.size() == 0 ? 0 : offsets_to.back()) + size);
|
||||
|
||||
if (!size)
|
||||
return;
|
||||
|
||||
typename ColumnFloat32::Container_t & data_to = static_cast<ColumnFloat32 &>(arr_to.getData()).getData();
|
||||
size_t old_size = data_to.size();
|
||||
data_to.resize(data_to.size() + size);
|
||||
@ -1021,6 +1024,9 @@ public:
|
||||
size_t size = levels.size();
|
||||
offsets_to.push_back((offsets_to.size() == 0 ? 0 : offsets_to.back()) + size);
|
||||
|
||||
if (!size)
|
||||
return;
|
||||
|
||||
typename ColumnFloat32::Container_t & data_to = static_cast<ColumnFloat32 &>(arr_to.getData()).getData();
|
||||
size_t old_size = data_to.size();
|
||||
data_to.resize(data_to.size() + size);
|
||||
|
@ -0,0 +1,8 @@
|
||||
[]
|
||||
[]
|
||||
[]
|
||||
[]
|
||||
[]
|
||||
[]
|
||||
[]
|
||||
[]
|
@ -0,0 +1,8 @@
|
||||
select quantiles(number) as q from (select * from system.numbers LIMIT 1000);
|
||||
select quantilesExact(number) as q from (select * from system.numbers LIMIT 1000);
|
||||
select quantilesExactWeighted(number, number) as q from (select * from system.numbers LIMIT 1000);
|
||||
select quantilesDeterministic(number, 10000000) as q from (select * from system.numbers LIMIT 1000);
|
||||
select quantilesTiming(number) as q from (select * from system.numbers LIMIT 1000);
|
||||
select quantilesTimingWeighted(number, number) as q from (select * from system.numbers LIMIT 1000);
|
||||
select quantilesTDigest(number) as q from (select * from system.numbers LIMIT 1000);
|
||||
select quantilesTDigestWeighted(number, number) as q from (select * from system.numbers LIMIT 1000);
|
Loading…
Reference in New Issue
Block a user