sort() function

sort() orders rows in each intput table based on values in specified columns.

Output data

One output table is produced for each input table. Output tables have the same schema as their corresponding input tables.

Sorting with null values

When desc: false, null values are last in the sort order. When desc: true, null values are first in the sort order.

Function type signature
(<-tables: stream[A], ?columns: [string], ?desc: bool) => stream[A] where A: Record
For more information, see Function type signatures.



List of columns to sort by. Default is ["_value"].

Sort precedence is determined by list order (left to right).


Sort results in descending order. Default is false.


Input data. Default is piped-forward data (<-).


Sort values in ascending order

import "sampledata"
    |> sort()

View example input and ouput

Was this page helpful?

Thank you for your feedback!

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.