mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 02:21:59 +00:00
Fix a corner case of windowFunnel with 'strict_order'
This commit is contained in:
parent
d8ff25d364
commit
210024cd3a
@ -186,6 +186,14 @@ private:
|
|||||||
{
|
{
|
||||||
return event_idx + 1;
|
return event_idx + 1;
|
||||||
}
|
}
|
||||||
|
else if (strict_order && first_event && events_timestamp[event_idx - 1] == -1)
|
||||||
|
{
|
||||||
|
for (size_t event = 0; event < events_timestamp.size(); ++event)
|
||||||
|
{
|
||||||
|
if (events_timestamp[event] == -1)
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (events_timestamp[event_idx - 1] >= 0 && timestamp <= events_timestamp[event_idx - 1] + window)
|
else if (events_timestamp[event_idx - 1] >= 0 && timestamp <= events_timestamp[event_idx - 1] + window)
|
||||||
{
|
{
|
||||||
events_timestamp[event_idx] = events_timestamp[event_idx - 1];
|
events_timestamp[event_idx] = events_timestamp[event_idx - 1];
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
[4, 2]
|
[4, 2]
|
||||||
[5, 2]
|
[5, 2]
|
||||||
[6, 1]
|
[6, 1]
|
||||||
|
[7, 1]
|
||||||
[1, 2]
|
[1, 2]
|
||||||
[2, 2]
|
[2, 2]
|
||||||
[3, 0]
|
[3, 0]
|
||||||
|
@ -63,6 +63,8 @@ insert into funnel_test_strict_order values (1, 6, 'c') (2, 6, 'c') (3, 6, 'b')
|
|||||||
select user, windowFunnel(86400)(dt, event='a', event='b', event='c') as s from funnel_test_strict_order group by user order by user format JSONCompactEachRow;
|
select user, windowFunnel(86400)(dt, event='a', event='b', event='c') as s from funnel_test_strict_order group by user order by user format JSONCompactEachRow;
|
||||||
select user, windowFunnel(86400, 'strict_order')(dt, event='a', event='b', event='c') as s from funnel_test_strict_order group by user order by user format JSONCompactEachRow;
|
select user, windowFunnel(86400, 'strict_order')(dt, event='a', event='b', event='c') as s from funnel_test_strict_order group by user order by user format JSONCompactEachRow;
|
||||||
select user, windowFunnel(86400, 'strict', 'strict_order')(dt, event='a', event='b', event='c') as s from funnel_test_strict_order group by user order by user format JSONCompactEachRow;
|
select user, windowFunnel(86400, 'strict', 'strict_order')(dt, event='a', event='b', event='c') as s from funnel_test_strict_order group by user order by user format JSONCompactEachRow;
|
||||||
|
insert into funnel_test_strict_order values (1, 7, 'a') (2, 7, 'c') (3, 7, 'b');
|
||||||
|
select user, windowFunnel(10, 'strict_order')(dt, event = 'a', event = 'b', event = 'c') as s from funnel_test_strict_order where user = 7 group by user format JSONCompactEachRow;
|
||||||
drop table funnel_test_strict_order;
|
drop table funnel_test_strict_order;
|
||||||
|
|
||||||
drop table if exists funnel_test_non_null;
|
drop table if exists funnel_test_non_null;
|
||||||
|
Loading…
Reference in New Issue
Block a user