Preparation node
Sort
Order rows by one or more columns.
What it does
Orders the rows by one or more columns. The first key sorts first and later keys break its ties, each ascending or descending independently. Missing values always sort last, whichever direction you choose. Sorting has to see every row before it can emit the first one, so this is a node the data collects at rather than flows through.
Inputs and outputs
| Inputs | One. |
| Outputs | One. |
When to use it
- Order a report: newest first, biggest first, alphabetically
- Sort within a group: by region, then by revenue inside each region
- Put rows in the right order before a Sample, a Unique, or an export
Examples
Newest first
created_at · Descending
The most common single-key sort there is.
Category then value
region · Ascending, then revenue · Descending
The second key decides the order inside each region.
Alphabetical
last_name · Ascending
Text sorts by character order, so casing can matter.
Pick the winner
Sort by updated_at Descending, then Unique on customer_id
Unique keeps the first row it sees, so sorting first is how you choose which one survives.
Tips
- Use the up and down arrows to set key priority; the top key is the primary sort.
- Nulls always land at the bottom, regardless of direction. There is no option to change that.
- Large sorts spill to disk automatically, so a sort bigger than memory slows down instead of failing.
- Nothing leaves this node until every row has arrived, so it's worth filtering upstream of a sort rather than downstream.
- Sorting purely to make a file look tidy is often wasted work. Sort where the order actually matters.