Berserk Docs
Tabular OperatorsLogging Operators

fieldstats

Analyzes dynamic column values to discover field paths and their statistics, returning a table with AttributePath, Type, Cardinality, Frequency, Hint, and HintExhaustive columns.

Analyzes dynamic column values to discover field paths and their statistics, returning a table with AttributePath, Type, Cardinality, Frequency, Hint, and HintExhaustive columns. HintExhaustive is true when the Hint values represent the complete set of distinct values.

Useful for exploring JSON-like data to understand what fields exist across records. Supports analyzing multiple columns in a single call. If no columns are specified, analyzes all input columns (or the _ column if present).

IMPORTANT: This is an expensive operation. Use the with limit=N parameter to limit samples (default 1000), or use | take N before fieldstats.

Use with depth=N to control how deep to descend into nested dynamic structures. When the depth limit is reached, nested objects and arrays are reported as dynamic type instead of recursing into their contents. depth=1 means only top-level fields.

Syntax

fieldstats [columns] [with limit=N depth=M]

Analyze fields in columns (all columns if none specified)

Parameters

NameDescription
columnsColumns to analyze (all columns if omitted) (optional)

with limit=

Maximum rows to sample (default 1000)

ValueDescription
NSample at most N rows.

with depth=

Nesting depth for dynamic columns

ValueDescription
NRecurse at most N levels (N must be > 0). depth=1 means top-level fields only.

Examples

Example 1 — Discover fields in a dynamic column

datatable(log:dynamic)[
  dynamic({"warrior":"Ragnar", "weapon":"axe", "voyages":42}),
  dynamic({"warrior":"Bjorn", "weapon":"sword", "voyages":31}),
  dynamic({"warrior":"Ivar", "weapon":"bow", "voyages":35})
]
| fieldstats log
AttributePath (string)Type (string)Cardinality (long)Frequency (real)Hint (dynamic)HintExhaustive (bool)
log.voyageslong31.0["31","35","42"]true
log.warriorstring31.0["Bjorn","Ivar","Ragnar"]true
log.weaponstring31.0["axe","bow","sword"]true

Example 2 — Analyze top-level fields only

datatable(log:dynamic)[
  dynamic({"ship":{"name":"Naglfar", "crew":80}, "destination":"Lindisfarne"}),
  dynamic({"ship":{"name":"Wave Rider", "crew":45}, "destination":"York"})
]
| fieldstats log with depth = 1
AttributePath (string)Type (string)Cardinality (long)Frequency (real)Hint (dynamic)HintExhaustive (bool)
log.destinationstring21.0["Lindisfarne","York"]true
log.shipdynamic01.0nulltrue

On this page