mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Added proper test for merging of "histogram" aggregate function states
This commit is contained in:
parent
1fdbb11bfb
commit
d3062924c8
@ -0,0 +1,6 @@
|
||||
0 55 101
|
||||
55 117 97
|
||||
117 199 92
|
||||
0 55 101
|
||||
55 117 97
|
||||
117 199 92
|
2
dbms/tests/queries/0_stateless/00919_histogram_merge.sql
Normal file
2
dbms/tests/queries/0_stateless/00919_histogram_merge.sql
Normal file
@ -0,0 +1,2 @@
|
||||
WITH arrayJoin(finalizeAggregation((SELECT histogramState(3)(number) FROM numbers(10, 190)) + (SELECT histogramState(3)(number) FROM numbers(0, 100)))) AS hist SELECT round(hist.1) AS l, round(hist.2) AS r, round(hist.3) AS cnt;
|
||||
WITH arrayJoin(finalizeAggregation((SELECT histogramState(3)(number) FROM numbers(0, 100)) + (SELECT histogramState(3)(number) FROM numbers(10, 190)))) AS hist SELECT round(hist.1) AS l, round(hist.2) AS r, round(hist.3) AS cnt;
|
@ -1,2 +0,0 @@
|
||||
199
|
||||
199
|
@ -1,34 +0,0 @@
|
||||
create table test.test_histogram (a Int32)
|
||||
ENGINE = Memory
|
||||
|
||||
--127.0.0.1
|
||||
insert into test.test_histogram (a) SELECT * FROM numbers(10, 190)
|
||||
|
||||
--127.0.0.2
|
||||
insert into test.test_histogram (a) SELECT * FROM numbers(0, 100)
|
||||
|
||||
|
||||
--make sure upper_bound=199
|
||||
--when merging AggregationState in both 1,2 and 2,1 order
|
||||
|
||||
with
|
||||
histogram(3)(a) AS hst,
|
||||
arrayJoin(hst) AS hst_array
|
||||
select
|
||||
round(hst_array.2) AS upper_bound
|
||||
from remote('127.0.0.{1,2}', 'test', 'test_histogram')
|
||||
having upper_bound = 199
|
||||
order by upper_bound desc
|
||||
limit 1
|
||||
|
||||
with
|
||||
histogram(3)(a) AS hst,
|
||||
arrayJoin(hst) AS hst_array
|
||||
select
|
||||
round(hst_array.2) AS upper_bound
|
||||
from remote('127.0.0.{2,1}', 'test', 'test_histogram')
|
||||
having upper_bound = 199
|
||||
order by upper_bound desc
|
||||
limit 1
|
||||
|
||||
drop table test.test_histogram
|
Loading…
Reference in New Issue
Block a user