ПФ
Size: a a a
ПФ
ПФ
GT
ПФ
ПФ
array($"_2").over(timeWindow)
нельзя :(А
with data as (select 1 as col1, 'a' as col2 union all select 2 as col1, 'b' as col2 union all select 3 as col1, 'a' as col2)
select d.* , case when d.col2 = lag(col2) over(order by col1) then 1 else 0 end + case when d.col2 = lag(col2,2) over(order by col1) then 1 else 0 end as cnt
from data d
ПФ
VS
VS
А
VS
А
ПФ
ПФ
ПФ
ПФ
VS
ПФ
ПФ
А