0

I'm trying to get use TimeStream to get the last non null value using last_value but so far haven't had any luck.

I've tried:

last_value(power ignore nulls) OVER (
        PARTITION BY deviceId ORDER BY time asc range BETWEEN unbounded preceding AND CURRENT row)

and also:

last_value(power) ignore nulls OVER (
        PARTITION BY deviceId ORDER BY time asc range BETWEEN unbounded preceding AND CURRENT row)

as per some documentation I've seen regarding SQL/Athena etc but am getting errors on the query.

Does Timestream support ignore nulls? I'm hoping it does as it will make a difference for my query.

halfer
  • 19,824
  • 17
  • 99
  • 186
ADringer
  • 2,614
  • 36
  • 63
  • Did you receive any error while running above queries? If yes share those details. I believe last_value(power ignore nulls) OVER (PARTITION BY deviceId ORDER BY time asc range BETWEEN unbounded preceding AND CURRENT row) should work. – Prabhakar Reddy Oct 10 '22 at 02:15
  • @PrabhakarReddy Yes I do get an error message, but unfortunately not very helpful: `The query syntax is invalid at line 21:34` – ADringer Oct 10 '22 at 08:12

0 Answers0