object_agg

Description

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.

Return type

object

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

Usage

object_agg( key, value )

Argument

Type

Required

Multiple

key

string

Required

Only one

value

any

Required

Only one

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.