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表示要填充的粒度,秒
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章