object_agg(key: string, value: storable) -> object

Extract aggregated fields and values from a group of rows into a new JSON object.

Returns one OBJECT per group.

For each (key, value) input pair, the resulting object contains a key:value field. The key column needs to be string. Duplicate keys within a group result in an error, and input tuples with NULL key and/or value are ignored.

Domain

This is an aggregate function (aggregates rows over a group in aggregate verbs).

This is a window function (calculates over a group of multiple input rows using windowing).

Categories

Examples

statsby clusterid, oa:object_agg(jobid, status), group_by(clusterid)

For each clusterid, return a JSON object containing the status of each jobid with the attached clusterid.