SQL Reference > Object Functions

Object Functions

This page covers functions for constructing and manipulating objects (string-keyed maps) in Rockset.

OBJECT

OBJECT(keys, values)

Construct an object from an array of keys and an array of values. keys must be an array of strings. values must be an arbitrary array of the same length as keys.

ZIP

ZIP(entries)

Construct an object from an array of entries. Each entry in entry must itself be an array of size 2: the first element is the key (and must be a string), and the second element is the value.

ELEMENT_AT

ELEMENT_AT(obj, key)

Return the value corresponding to key, or NULL if key does not exist in obj.

LENGTH

LENGTH(obj)

Returns number of elements in obj.

KEYS

KEYS(obj)

Return an array containing the keys of obj. The order is unspecified, but will be the same between KEYS(), VALUES(), and ITEMS().

VALUES

VALUES(obj)

Return an array containing the values of obj. The order is unspecified, but will be the same between KEYS(), VALUES(), and ITEMS().

ITEMS

ITEMS(obj)

Return an array containing the entries of obj. Each entry is a 2-element array; the first is the key, the second is the value. The order is unspecified, but will be the same between KEYS(), VALUES(), and ITEMS().

MERGE

MERGE(a, b)

Return a new object containing the values from a and b. If the same key exists in both a and b, the value from b will overwrite the value from a.

ERASE

ERASE(obj, k)

If k is a string, return a new object where the key k is erased. If k is an array of strings, return a new object where the keys in k are erased.