всем привет! подскажите, пожалуйста, почему не обновляется МВ? есть предположение, что, так как записи добавляются построчно, то используемый фильтр автоматически их фильтрует. можно ли как-то это обойти? текст запроса привожу ниже
CREATE MATERIALIZED VIEW retained_users
engine = AggregatingMergeTree order by(
city_id
,initial_date
,retention_date
,retention
)
populate
as
select
city_id
,udate[1] as initial_date
,date as retention_date
,date - udate[1] as retention
,countState(user_id) as retained_users_cnt
from(
select city_id
,user_id
,arraySort(arrayReduce('groupUniqArray', groupArray(date))) as udate
,arrayEnumerate(udate) as dindex
,arrayFilter(date, index -> (udate[index] - udate[1] == 1) or
(udate[index] - udate[1] == 3) or (udate[index] - udate[1] == 7) or
(udate[index] - udate[1] == 14) or (udate[index] - udate[1] == 28) or
(udate[index] - udate[1] == 60) or (udate[index] - udate[1] == 90) or
(udate[index] - udate[1] == 180) or (udate[index] - udate[1] == 360),
udate, dindex) as udate_filter
from table_users
group by user_id
,city_id
)
array join udate_filter as date
group by
city_id
,udate[1]
,date
,date - udate[1];