Computes the number of elements in the arrays in the specified column, array literal, or function that returns an array.

Array literal reference example:

derive type:single value:ARRAYLEN([A,B,C,D])

Output: Generates the count of elements in the array, which is 4

Column reference example:

derive type:single value:ARRAYLEN([myValues]) as:'length_myValues'

Output: Generates the new length_myValues column containing the count of elements in the myValues column.

Array function example:

derive type:single value:ARRAYLEN(concat([colA,colB])) as:'length_myValues'

Output: Generates the new  length_myValues  column containing the count of elements in the array returned from concatenating colA and colB

derive type:single value:ARRAYLEN(array_ref)

ArgumentRequired?Data TypeDescription
array_refYstringName of Array column, Array literal, or function returning an Array to apply to the function

array_ref

Name of the array column, array literal, or function returning an array whose elements you want to count.

 

Required?Data TypeExample Value
YesString (column reference or function) or array literalmyArray1

Example - Unnest an array