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:

  1. column: A column of type array to be sliced.
  2. begin: The index of array (first being 0) to start slice from.
  3. end: The index of array to end slice at.

Output:

  1. 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()


Did this page help you?