Berserk Docs
Tabular OperatorsOther Operators

mv-apply

Applies a subquery to each record and returns the union of results.

Applies a subquery to each record and returns the union of results. Similar to mv-expand but allows complex transformations.

Syntax

mv-apply column on (subquery)

Apply subquery to expanded values

Parameters

NameDescription
columnColumn containing dynamic array to expand
subqueryQuery to apply to each expanded element

Examples

Example 1

datatable(jarl:string, raids:dynamic)[
  "Erik", dynamic([100, 50, 200]),
  "Olaf", dynamic([300, 150])
]
| mv-apply raids on (summarize total = sum(raids))
jarl (string)total (real)
Erik350.0
Olaf450.0

Example 2

datatable(ship:string, cargo:dynamic)[
  "Naglfar", dynamic(["silver", "iron", "gold", "amber"]),
  "Wave Rider", dynamic(["furs", "ivory", "silver"])
]
| mv-apply cargo on (where cargo != "iron")
ship (string)cargo (dynamic)
Naglfar"amber"
Naglfar"gold"
Naglfar"iron"
Naglfar"silver"
Wave Rider"furs"
Wave Rider"ivory"
Wave Rider"silver"

On this page