Merge pull request #60532 from wangtZJU/fix_boundRatio_incorrect_merge

Fix boundRatio incorrect merge
This commit is contained in:
Alexey Milovidov 2024-05-03 01:57:09 +00:00 committed by GitHub
commit 8408758705
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 0 deletions

View File

@ -63,6 +63,11 @@ struct AggregateFunctionBoundingRatioData
{
*this = other;
}
else if (other.empty)
{
// if other.empty = true, other.x/other.y may be uninitialized values,
// so don't use them to update this->state
}
else
{
if (other.left.x < left.x)

View File

@ -0,0 +1,16 @@
drop table if exists rate_test;
drop table if exists rate_test2;
create table rate_test (timestamp UInt32, event UInt32) engine=Memory;
insert into rate_test values (0,1000),(1,1001),(2,1002),(3,1003),(4,1004),(5,1005),(6,1006),(7,1007),(8,1008);
create table rate_test2 (timestamp UInt32, event UInt32) engine=Memory;
SELECT boundingRatioMerge(state) FROM (
select boundingRatioState(timestamp, event) as state from rate_test
UNION ALL
SELECT boundingRatioState(timestamp, event) FROM rate_test2 WHERE 1=0
);
drop table if exists rate_test;
drop table if exists rate_test2;