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
| Name | Description |
|---|---|
| columns | Columns to analyze (all columns if omitted) (optional) |
with limit=
Maximum rows to sample (default 1000)
| Value | Description |
|---|---|
N | Sample at most N rows. |
with depth=
Nesting depth for dynamic columns
| Value | Description |
|---|---|
N | Recurse 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.voyages | long | 3 | 1.0 | ["31","35","42"] | true |
| log.warrior | string | 3 | 1.0 | ["Bjorn","Ivar","Ragnar"] | true |
| log.weapon | string | 3 | 1.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.destination | string | 2 | 1.0 | ["Lindisfarne","York"] | true |
| log.ship | dynamic | 0 | 1.0 | null | true |