Reverse / Array Layer
Reverse the order of elements in each fixed-length array. Similar to Python's reversed() or R's rev(). Creates a new array column with elements in reverse order.
Example transformation (arrays of length 3):
arrays | reversed |
---|---|
[1, 2, 3] | [3, 2, 1] |
[a, b, c] | [c, b, a] |
[true, false, true] | [true, false, true] |
[1, null, 3] | [3, null, 1] |
Common applications:
- Inverting sequences
- Processing time series backwards
- Reversing priority orders
- Creating palindrome checks
Note: All arrays must have the same fixed length. Preserves null values in their reversed positions.
Table
0
0
Table
Select
columnThe fixed-length array column to reverse. All arrays must have same length:
- Numeric arrays: [1, 2, 3]
- String arrays: [a, b, c]
- Boolean arrays: [true, false, true]
- Date/time arrays: [2024-01-01, 2024-01-02, 2024-01-03]
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.