RELATED
All functions > ROW > RELATED
Syntactic sugar for EXTEND that adds a single joined feature without wrap/unwrap operations
Syntax
RELATED(base, add, agg_function, groupby) sql
Arguments
| Parameter | Type | Required | Description |
|---|---|---|---|
add | FEATURE | Yes | Array of features to add (typically one feature) |
base | FEATURE | Yes | Base feature to use for binding |
agg_function | EMPTY | Yes | Optional aggregation function name for RELATED_AGG variant |
groupby | EMPTY | Yes | Optional array of groupby expressions for RELATED_AGG variant |
Returns
Expression - The joined feature value
Notes
- RELATED is syntactic sugar for EXTEND with automatic wrap/unwrap
- RELATED(joined_feature VIA base_feature) expands to: EXTEND(joined_feature AS joined_field WITH ROW(base_feature AS field_name))[joined_field]
- Avoids the manual ROW construction and field extraction needed with EXTEND
- RELATED_AGG variant supports aggregation functions with GROUP BY
- Will be rewritten to EXTEND/ADD_FIELDS during query processing