Clickhouse分桶聚合后填充零值问题

select count(a) as acount, toStartOfInterval(timestamp, INTERVAL 1440 minute) as c_time
from `fill_test`
where b = 'hello'
  and timestamp >= '2022-01-01 00:00:00'
  and timestamp <= '2022-04-31 23:59:59'
group by c_time
order by c_time asc WITH FILL FROM toDateTime('2022-01-01 00:00:00') TO toDateTime('2022-04-31 23:59:59') STEP 1 * 60 * 60 * 24;
  • 使用WITH FILL对order by的字段进行填充
  • FROM...TO 标识要填充的范围
  • STEP表示要填充的粒度,秒
posted @ 2022-03-31 23:29  x1aoda1  阅读(490)  评论(0编辑  收藏  举报