how can I test flux queries if they do not return table
I have a custom function:
consumed = (session) => {
readBytes = from(bucket: “turn”) // Replace “your_bucket” with your InfluxDB bucket name
|> range(start: -2d)
|> filter(fn: (r) => r[“_measurement”] == “all_usage”)
|> filter(fn: (r) => r[“_field”] == “read_bytes”)
|> filter(fn: (r) => r[“session”] == session)
|> group()
|> sum()
|> findColumn(
fn: (key) => 1 == 1 ,
column: “_value”,
)return readBytes[0]
}
which I can later on used in a map:
|> map(fn: (r) => ({ r with
read_bytes: consumed(session: r.session)
})
and this works. But I am not able to test my functions query and see an output of it.
I tried in “Data Explorer”: something like:
yield(tables: readBytes[0])
error calling function “yield” @12:1-12:28: argument is not a table object: got values.value
or
|> findColumn( fn: (key) => 1 == 1 , column: "_value", ) |> yield()
expected stream[A] but found [A] (array) (argument tables)flux
so how to test such queries ?