Skip to content

fix(eap): flatten nested attributes_array JSON for dotted keys#7911

Merged
manessaraj merged 4 commits intomasterfrom
sarajmanes/feat/exp-915-silently-ignore-parsing-errors
Apr 29, 2026
Merged

fix(eap): flatten nested attributes_array JSON for dotted keys#7911
manessaraj merged 4 commits intomasterfrom
sarajmanes/feat/exp-915-silently-ignore-parsing-errors

Conversation

@manessaraj
Copy link
Copy Markdown
Contributor

ClickHouse can emit nested objects for dotted keys under toJSONString(attributes_array). Flatten that shape back to dotted attribute names before decoding tagged array elements. All parsing stays in process_arrays (common.py); bad JSON or structure raises BadSnubaRPCRequestException.

fixes EXP-915

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Apr 28, 2026

ClickHouse can emit nested objects for dotted keys under toJSONString(attributes_array).
Flatten that shape back to dotted attribute names before decoding tagged array elements.
All parsing stays in process_arrays (common.py); bad JSON or structure raises
BadSnubaRPCRequestException.

fixes EXP-915
@manessaraj manessaraj force-pushed the sarajmanes/feat/exp-915-silently-ignore-parsing-errors branch from 260fd78 to c8d50c0 Compare April 28, 2026 19:29
@manessaraj manessaraj marked this pull request as ready for review April 28, 2026 19:30
@manessaraj manessaraj requested review from a team as code owners April 28, 2026 19:30
Comment thread snuba/web/rpc/common/common.py Outdated


def _flatten_attributes_array_json(node: dict[str, Any], prefix: str = "") -> dict[str, list[Any]]:
"""Flatten nested dicts into dotted keys (name -> list). ClickHouse often nests dotted paths."""
Copy link
Copy Markdown
Contributor

@onewland onewland Apr 28, 2026

Choose a reason for hiding this comment

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

let's change this comment to say that ClickHouse stores all JSON objects as flat and interprets dotted paths in a special way to support nesting, then link to the relevant ClickHouse docs

Copy link
Copy Markdown
Member

@kylemumma kylemumma left a comment

Choose a reason for hiding this comment

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

lgtm once you address olivers comment

Comment thread snuba/web/rpc/common/common.py
@manessaraj manessaraj enabled auto-merge (squash) April 29, 2026 13:18
@manessaraj manessaraj merged commit 8684bba into master Apr 29, 2026
48 of 49 checks passed
@manessaraj manessaraj deleted the sarajmanes/feat/exp-915-silently-ignore-parsing-errors branch April 29, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants