Type test in Flux?

Hello,

is there a way to get the type of a field/column in Flux?

I want to calculate percentiles for all float fields. For this I need to filter the fields by type like this:

floatValues = from(bucket: "mybucket")
                |> range(start: 1970-01-01T00:00:00Z)
                |> filter(fn: (r) => r._measurement == "mymeasurement" and r._fieldType = "float")

However, I could not find a function/attribute like “_fieldType”.
Is it possible to add such a function or can I solve this in another way?

The way that I would solve this is using a tag when setting the value. Then you can do something like

from(bucket: "mybucket")
    |> filter(fn: (r) => r._measurement == "mymeasurement" and r.my_field_type == "float")

That’s not ideal, but there currently isn’t a way to get the field type.

1 Like

Thank you. Then I have to do it like that for now.