I’m receiving the following error when I try to map the date.sub function to the first records in a table. Any advise would be appreciated.
import "date"
data = from(bucket: "xxxxxxxxx")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "xxxxxxxxx")
first = data
|> first(column: "_time")
|> map(fn: (r) => ({r with diff: date.sub(d:7d,from:r._time)}))
|> yield()
this returns:
error @11:44-11:48: record is missing label sub