我需要找到温度的7天滚动平均值 .

使用我的数据集中提供的日期字符串,我创建了一个unix时间戳 . 我在当天的午夜用相关的unix时间戳替换了每天的第一个时间戳 .

The data looks like this

一周内有604800个unix秒,所以我尝试使用以下代码来计算它,但它没有用 . 如何修复此代码以便正确执行窗口计算?

DROP VIEW IF EXISTS every_7_days;
CREATE VIEW every_7_days AS
SELECT weather_dt,
       time,
       fixed_unix_time,
       temperature,
       avg(temperature) OVER(ORDER BY fixed_unix_time RANGE BETWEEN 604800 PRECEDING AND CURRENT ROW) AS roll7day_avg
  FROM clean_first_row
  ORDER BY fixed_unix_time;