Sort / List Layer

Sort elements within variable-length lists. Similar to Python's sorted() or R's sort(). Creates a new list with sorted elements preserving the original length.

Example transformation:

listssorted
[3, 1, 2, 5, 4][1, 2, 3, 4, 5]
[c, a, b][a, b, c]
[2, null, 1][1, 2, null]
[null, 5, null, 3][3, 5, null, null]
[][]

Common applications:

  • Ordering transaction histories
  • Ranking performance metrics
  • Sorting event timestamps
  • Organizing categorical data
  • Normalizing sequences
  • Creating ordered lists for display

Note: Lists can have any length. Type-specific comparison for ordering. Empty lists remain empty. Particularly useful for organizing variable-length sequences while maintaining their original size.

Table
0
0
Table

Select

column

The variable-length list column to sort. Examples:

  • Numeric lists: [3, 1, 2, 5, 4]
  • String lists: [charlie, alpha, beta]
  • Date lists: [2024-01-01, 2023-12-31]
  • Mixed lengths: [1, 2], [1, 2, 3, 4] Lists can have different lengths. Elements must be of same type.
false

Sort order direction:

  • false (default): ascending (smaller to larger) Numbers: [1, 2, 3, 4] Text: [alpha, beta, gamma]
  • true: descending (larger to smaller) Numbers: [4, 3, 2, 1] Text: [gamma, beta, alpha]
false

Null value placement:

  • false (default): nulls first [null, null, 1, 2, 3]
  • true: nulls last [1, 2, 3, null, null]

Name for the new column. If not provided, the system generates a unique name. If AsColumn matches an existing column, the existing column is replaced. The name should follow valid column naming conventions.