Skip to content

fix(parsers.json_v2): reset sub-path results for each object config#19222

Open
larrasket wants to merge 1 commit into
influxdata:masterfrom
larrasket:json-v2-object-field-rename
Open

fix(parsers.json_v2): reset sub-path results for each object config#19222
larrasket wants to merge 1 commit into
influxdata:masterfrom
larrasket:json-v2-object-field-rename

Conversation

@larrasket

Copy link
Copy Markdown

Summary

processObjects appended object config's field/tag path results to the shared subPathResults slice without clearing it between objects. The recorded indexes are byte offsets within each object's own scoped JSON, when two objects had structurally similar sub-documents, a field in a later object matched an earlier object's entry and took its rename and type. With two objects each selecting a field at the same relative path, both fields were emitted under the first object's rename.

this resets subPathResults at the start of each object iteration so path results are only matched within the object they belong to.

Checklist

Related issues

resolves #16361

processObjects appended every object config's field/tag path results to
the shared subPathResults slice without clearing it between objects. The
recorded indexes are byte offsets within each object's own scoped JSON,
so when two objects had structurally similar sub-documents, a field in a
later object matched an earlier object's entry and took its rename and
type. With two objects each selecting a field at the same relative path,
both fields were emitted under the first object's rename.

Reset subPathResults at the start of each object iteration so path
results are only matched within the object they belong to.
@telegraf-tiger

telegraf-tiger Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@telegraf-tiger telegraf-tiger Bot added area/json json and json_v2 parser/serialiser related fix pr to fix corresponding bug plugin/parser 1. Request for new parser plugins 2. Issues/PRs that are related to parser plugins labels Jul 4, 2026
@larrasket

Copy link
Copy Markdown
Author

!signed-cla

@telegraf-tiger

telegraf-tiger Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/json json and json_v2 parser/serialiser related fix pr to fix corresponding bug plugin/parser 1. Request for new parser plugins 2. Issues/PRs that are related to parser plugins

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSON field rename doesn't work if field path is the same path as another field

1 participant