Flux doesn't seem to sort on _time as is expected

For some reason when i execute the following flux query, the results are not sorted in order of timestamp:
from(bucket: "my_bucket"
|> range(start: -10y, stop: now())
|> filter(fn: (r) => r._measurement == "m" and r._field == "temperature" and exists r._value)
|> keep( columns: ["_time"])

Whitness the following snippet of the data:
image

Why isn’t the data sorted?

Apparently influxdb doesn’t sort the data when it is ingested.

1 Like

Same issue as well…Any solutions?

Hello @Symeon_Mattes,
Some functions don’t preserve time order.
Im surprised that those functions you used aren’t preserving it but you can use the sort function:

geo.toRows also doesn’t preserve time order, needed quite a time until i found out why the boolean i used fill(previous) on afterwards missed almost all their “false” values