有没有办法在 BIGQUERY 的 window 帧中识别最新的非空值?

Is there a way to to identify the latest non null value in a window frame in BIGQUERY?

我希望我能得到一些帮助,以识别 BigQuery 中按日期排序的 window 帧中的最新非空值。到目前为止,我尝试了一些 first_value 和分区,但没有成功。

输入:

Date Key Status
2021-01-13 1 In Progress
2021-01-13 2 Closed
2021-01-14 1 Waiting
2021-01-14 2 NULL
2021-01-15 1 NULL
2021-01-15 2 NULL
2021-01-16 1 NULL
2021-01-16 2 NULL
2021-01-17 1 In Progress
2021-01-17 2 NULL
2021-01-18 1 NULL
2021-01-18 2 NULL

预期输出为:

Date Key Status
2021-01-13 1 In Progress
2021-01-13 2 Closed
2021-01-14 1 Waiting
2021-01-14 2 Closed
2021-01-15 1 Waiting
2021-01-15 2 Closed
2021-01-16 1 Waiting
2021-01-16 2 Closed
2021-01-17 1 In Progress
2021-01-17 2 Closed
2021-01-18 1 In Progress
2021-01-18 2 Closed

希望我已经包含了相关信息。 预先感谢您的帮助

考虑以下方法

select * except(status),
  last_value(status ignore nulls) over(partition by key order by date) as status
from your_table           

如果应用于您问题中的示例数据 - 输出为