first
The first value by the measure's order_by (nulls included).
Flags
| Flag | Value |
|---|---|
| Kind | aggregate |
| Nulls | nulls are skipped |
| Deterministic | yes |
| Order matters | yes |
| Decomposable | yes, by value and order key |
Example
A pipeline from the language's tested corpus that uses first, over the example tables.
from orders
aggregate {first_status = first(status, order_by: {placed}), last_status = last(status, order_by: {placed desc}), all_ids = list(id, order_by: {id}), names = string_agg(status, sep: "|", order_by: {id})} by:{customer}In a plan:
{
"args": [
{
"col": 7
}
],
"fn": "first"
}