I have a problem with the last() function (InfluxDB 2.0.4-2, Arch Linux) when executed on a bucket stored on disk. The data ranging from 14 Feb 2021 - 14 Mar 2021 is from my smart energy meter.
The last data point was requested,
from(bucket: "last-test")
|> range(start: -1mo)
|> last()
but output of the incorrect first data point with timestamp 14 Feb 2021 (_time
column) returned:
,result,table,_start,_stop,_time,_value,_field,_measurement
,,0,2021-02-13T10:38:06.059009644Z,2021-03-15T21:08:06.059009644Z,2021-02-14T23:00:00Z,1.565374469739827,bill,daily
,,1,2021-02-13T10:38:06.059009644Z,2021-03-15T21:08:06.059009644Z,2021-02-14T23:00:00Z,4.465795000000071,energy,daily
,,2,2021-02-13T10:38:06.059009644Z,2021-03-15T21:08:06.059009644Z,2021-02-14T23:00:00Z,0.2426,price,daily
,,3,2021-02-13T10:38:06.059009644Z,2021-03-15T21:08:06.059009644Z,2021-02-14T23:00:00Z,14.66,rate,daily
,,4,2021-02-13T10:38:06.059009644Z,2021-03-15T21:08:06.059009644Z,2021-02-14T23:00:00Z,4405.794864,total,daily
However, the correct last data point with timestamp 14 Mar 2021 is selected when the same dataset was not stored on disk, but directly given in a csv file embedded in the flux query:
import "csv"
data = csv.from(csv: "
...
...
")
data
|> last()
Output:
,result,table,_start,_stop,_time,_value,_field,_measurement
,,0,2021-02-13T06:23:59.047896607Z,2021-03-15T16:53:59.047896607Z,2021-03-14T23:59:59.88Z,2.9910504875398063,bill,daily
,,1,2021-02-13T06:23:59.047896607Z,2021-03-15T16:53:59.047896607Z,2021-03-14T23:59:59.88Z,10.342448000000331,energy,daily
,,2,2021-02-13T06:23:59.047896607Z,2021-03-15T16:53:59.047896607Z,2021-03-14T23:59:59.88Z,0.2426,price,daily
,,3,2021-02-13T06:23:59.047896607Z,2021-03-15T16:53:59.047896607Z,2021-03-14T23:59:59.88Z,14.66,rate,daily
,,4,2021-02-13T06:23:59.047896607Z,2021-03-15T16:53:59.047896607Z,2021-03-14T23:59:59.88Z,4701.490756,total,daily
I have prepared an tar.gz archive (40 KB) with the dataset and all queries here (link valid until 31 Mar 2021).
Any ideas what could have gone wrong?