Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/partials/operators/ParsingOptions.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
import Base from "../ParsingOptionsBase.mdx";

### Duplicate Keys

If the parser encounters a duplicate key in an event, it will transparently
upgrade the field to be a list of values instead. If the values are of different
type, conversions to a common type will be attempted, such as to a common number
type. Ultimately values will be stringified if they do not share a common type.

For a simple example, consider this JSON file:
```json title="Example JSON with duplicate key" {2}
Comment on lines +10 to +11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For a simple example, consider this JSON file:
```json title="Example JSON with duplicate key" {2}
For a simple example, consider this JSON file:
```json title="Example JSON with duplicate key" {2}

Probably needed to satisfy the linter.

{ "key": 7 }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ "key": 7 }
{"key": 7}

This is how we render records typically.

{ "key": 0.0, "key": 1 }
{ "key": 42 }
```
The event with a duplicate key has the respective value upgraded to a list:
```tql {2}
{ key: 7 }
{ key: [0.0, 1.0] }
{ key: 42 }
```

### `merge = bool (optional)`

Merges all incoming events into a single schema\* that converges over time. This
Expand All @@ -8,4 +28,6 @@ to huge schemas filled with nulls and imprecise results. Use with caution.

\*: In selector mode, only events with the same selector are merged.

In merging mode, a repeated key will always overwrite the previous value.

<Base />
Loading