79278412

Date: 2024-12-13 13:07:03
Score: 0.5
Natty:
Report link

You need to specify the window frame clause:

SELECT
  id,
  value,
  FIRST_VALUE(value IGNORE NULLS) OVER (ids) AS first_valid_value,
  LAST_VALUE(value IGNORE NULLS) OVER (ids) AS last_valid_value,
  update_ts
FROM sample_data
WINDOW ids AS (PARTITION BY id ORDER BY update_ts DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)

Output: query output

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
Posted by: Damião Martins