Influxdb 2.0 toFloat() error

I try to convert a fild to float using the toFloat command, using a task.

from(bucket: "ite")
	|> filter(fn: (r) =>
		(r._measurement == "ITE02" and r._field == "ITE02_T"))
	|> toFloat()

Runing the task fails with the following error:

|2020-11-18 09:41:07 +0100|Started task from script: “option task = {name: “float”, every: 600s}\n\nfrom(bucket: “ite”)\n\t|> filter(fn: ® =>\n\t\t(r._measurement == “ITE02” and r._field == “ITE02_T”))\n\t|> toFloat()”|
| — | — | — | — |
|2020-11-18 09:41:08 +0100|Completed(failed)|
|2020-11-18 09:41:08 +0100|Error exhausting result iterator; Err: error in building plan while starting program: cannot submit unbounded read to “ite”; try bounding ‘from’ with a call to ‘range’: error in building plan while starting program: cannot submit unbounded read to “ite”; try bounding ‘from’ with a call to ‘range’|

@hermiot You need a range() in the query. Flux doesn’t allow unscoped queries (to protect accidental queries that could kill the db). In your task, try:

from(bucket: "ite")
  |> range(start: -task.every)
  |> filter(fn: (r) =>
    (r._measurement == "ITE02" and r._field == "ITE02_T"))
  |> toFloat()

You may also want to add an offset to your task to make sure data has time to be written and you don’t miss any points that come in after the task begins. A 5-10 second offset should be plenty.