Array Operator ([ ]) [Tech Preview]

On This Page
Tech Preview Note
The array opeartor is provided as a Tech Preview feature, which is included in the current release as a sneak peek to future release features but without official support in this release. Note that Tech Preview features don’t go through QA cycles and might result in unexpected behavior. Please consult the Iguazio support team before using these features.

Overview

The platform enables you to define array attributes — blob attributes that represent numeric arrays of 64-bit integer or double values. See Array-Attribute Expression Variables. You can use one of the following syntax variations of the array operator ([]) to reference specific elements of an array attribute in an update expression. In all variations, an element’s index number can also be provided as an expression that evaluates to an integer.

Single Array Element

ATTRIBUTE[i]

This syntax references an element at the specified zero-based index (i) of an array attribute (ATTRIBUTE). For example, "km[ctr+1]", where ctr is a numeric attribute with the value 2, references the fourth element (index 3) of the km array attribute.

Array Slice

ATTRIBUTE[istart..iend]

This syntax references an array slice — a range of elements between the specified zero-based start (istart) and end (iend) indexes of an array attribute (ATTRIBUTE). Note that the range includes the end index. In v2.3.1, the following uses of array slices in expressions are supported:

  • As a parameter of the max or min function — to retrieve the highest or lowest value from among the elements in the specified array slice. For example, "max(arr[2..10])" returns the highest value from among the values of the arr array attribute’s elements at indexes 2 to 10.
  • As an operand of the array operator ([]) in a SET update expression — to assign a slice of an existing array attribute to another array attribute. For example, "SET arr2 = arr1[0..4]" assigns the values of the first five elements of an existing arr1 array attribute to an arr2 attribute.

See Also