Skip to content

fix(app): address JSON array elements by index in row-panel filters - #3642

Draft
ralaruri wants to merge 2 commits into
ClickHouse:mainfrom
ralaruri:fix/json-array-paths
Draft

ralaruri wants to merge 2 commits into
ClickHouse:mainfrom
ralaruri:fix/json-array-paths

Conversation

@ralaruri

@ralaruri ralaruri commented Nov 12, 2026 •

Copy link
Copy Markdown

Summary

Based on #3641. Until that merges, this PR's diff includes its commit; the change for this PR is the last commit only.

"Add to Filters" on a value inside an array in a native JSON column returns no rows and shows no error. The row panel writes array positions as quoted keys, message.`events`.`0`.`detail`.`parameters`.`1`.`value` . ClickHouse finds no such key. Array elements need 1-based subscripts: message.`events`[1].`detail`.`parameters`[2].`value` .

mergePath takes an optional set of array positions and writes [N+1] there for JSON columns. The row viewer works out the positions by walking the row data it already holds. Callers that pass no positions are unchanged: numeric segments stay quoted keys, which facet keys from the JSON schema rely on (a test pins this).

Limitation: positions come from the row as displayed. If the viewer hides blank values, array positions can shift, as they already can for Array columns.

Tests: mergePath cases (array positions, nested arrays, a numeric object key that must stay quoted) and tests for the new getArrayIndexPositions helper. They fail on main and pass here. tsc and the related jest suites pass.

Screenshots or video

Before After

How to reproduce

Starting point: same setup as #3641 and #3640, with rows like this instead:
{"email":"user@example.test","events":[{"name":"event_a","detail":{"parameters":[{"name":"param_1","value":"x"},{"name":"param_2","value":"EMAIL_SERVICE"}]}}]}

On main:

  1. Open the source, last hour, Run.
  2. Expand a row → message → events → 0 → detail → parameters → 1. Hover value and click the filter icon.
  3. The table shows no rows and no error. In </>, the filter uses message.`events`.`0`…`parameters`.`1`.`value` .

On this branch:

  1. Same steps. Rows show.
  2. In </>, the filter uses `events`[1] and `parameters`[2].

How to test on Vercel preview

N/A. It needs a source with a native JSON column.

References

@vercel

vercel Bot commented Nov 12, 2026

Copy link
Copy Markdown

@ralaruri is attempting to deploy a commit to the HyperDX Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d5be2e2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

ralaruri and others added 2 commits November 12, 2026 15:26
…re-escaped

Adding a second filter re-escaped every key in the filter state.
toClickHouseKeyExpression treated a dotted key under a native JSON column
as a Map key and rewrote it to col['key'], which ClickHouse rejects:
'First argument for function arrayElement must be array, got JSON'.

Pass the table's JSON column names into escapeFilterStateKeys and
toQuotedClickHouseKeyExpression, so keys under a JSON column are written
as toString(`col`.`a`.`b`), the form the row panel already produces.
Array subscripts in a path (`col`.`a`[1]) stay subscripts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The row panel wrote array positions inside a native JSON column as quoted
keys (col.`events`.`0`.`id`). ClickHouse finds no such key, so the filter
silently matched no rows. Array elements are addressed with 1-based
subscripts (col.`events`[1].`id`).

mergePath takes an optional set of array positions and writes [N+1] there for
JSON columns. The row viewer derives the positions from the row data.
Callers that pass no positions keep numeric segments as quoted keys, which
facet keys from the JSON schema rely on.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ralaruri
ralaruri force-pushed the fix/json-array-paths branch from 102cc8d to d5be2e2 Compare November 12, 2026 20:26

This branch has not been deployed

No deployments
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.

Add to Filters on a value inside an array in a native JSON column silently returns no rows

1 participant