slice
Slice an array.
Slice an array with desired begin and end indices.
Usage Details
select *, slice(column, begin, end) as slicedColumn from tableName
Input Parameters:
column
: A column of type array to be sliced.begin
: The index of array (first being 0) to start slice from.end
: The index of array to end slice at.
Output:
slicedColumn
: Sliced array from begin to end where each element is of type string.
Example
Input Table: input_table
Id | list_ts |
---|---|
1 | WrappedArray(1517348699000, 1517351974000, 1517349002000) |
2 | WrappedArray(1517349299000) |
3 | WrappedArray() |
select *, slice(list_ts, 1, 3) as sliced_ts from input_table
id | list_ts | sliced_ts |
---|---|---|
1 | WrappedArray(1517348699000, 1517351974000, 1517349002000) | WrappedArray(1517351974000, 1517349002000) |
2 | WrappedArray(1517349299000) | WrappedArray(1517349299000) |
3 | WrappedArray() | WrappedArray() |
Updated about 1 year ago