Reverse / List Layer
Reverse the order of elements in each variable-length list. Similar to Python's reversed() or R's rev(). Creates a new list column with elements in reverse order.
Example transformation:
lists | reversed |
---|---|
[1, 2, 3, 4] | [4, 3, 2, 1] |
[a, b] | [b, a] |
[true] | [true] |
[1, null, 3, null] | [null, 3, null, 1] |
[] | [] |
Common applications:
- Reversing chronological sequences
- Processing time series backwards
- Analyzing recent-to-old patterns
- Creating palindrome checks
- Reversing priority queues
- Handling last-in-first-out scenarios
Note: Lists can have any length, including empty. Preserves null values in their reversed positions. Empty lists remain empty. Particularly useful for changing temporal perspective or processing sequences in reverse order.
Table
0
0
Table
Select
columnThe variable-length list column to reverse. Examples:
- Time series: [val1, val2, val3, val4]
- Event logs: [event1, event2, event3]
- Command history: [cmd1, cmd2]
- Message thread: [msg1, null, msg3] Lists can have different lengths, including empty lists.
AsColumn
nameName 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.