FIRST_ARRAY
Returns the first array of values seen in events within the time window. Unlike FIRST_K, this aggregation will not aggregate values across different events.
Syntax
FIRST_ARRAY(VALUE)
Arguments
VALUE:
An expression of any type.
Returns
The result is an array of the same type as VALUE
.
Example
Data
[
{
"id":1,
"name":"Jimmy",
"emails":[
"[email protected]",
"[email protected]"
]
}{
"id":2,
"name":"Peter",
"emails":[
"[email protected]"
]
}{
"id":1,
"name":"Jimmy",
"emails":[
"[email protected]",
"[email protected]"
]
}{
"id":3,
"name":"Link",
"emails":[
]
}
]
Query
Display the earliest contents of a field for each key:
SELECT
data.id AS id:BIGINT,
FIRST_ARRAY(data.emails[]) AS first_array_data_emails:STRING
FROM
"FIRST_ARRAY_DATA"
GROUP BY
data.id
Results
{
"id":2,
"first_array_data_emails":[
"[email protected]"
]
}{
"id":3
}{
"id":1,
"first_array_data_emails":[
"[email protected]",
"[email protected]"
]
}
Related Functions
Dialog

Last updated
Was this helpful?