Skip to content

Cherry pick #115329 to 26.3: Fix not applying max_dynamic_subcolumns_in_json_type_parsing for inserts in some cases - #116408

Merged
robot-ch-test-poll4 merged 7 commits into
backport/26.3/115329from
cherrypick/26.3/115329
Sep 6, 2026
Merged

robot-ch-test-poll4 merged 7 commits into
backport/26.3/115329from
cherrypick/26.3/115329

Conversation

@robot-clickhouse-ci-2

Copy link
Copy Markdown
Contributor

Original pull-request #115329

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

Felixoid and others added 6 commits August 18, 2026 19:35
`max_dynamic_subcolumns_in_json_type_parsing` is applied to the parsed
`ColumnObject` instance and not to the type, so it was lost whenever parsed
data was aggregated into columns built from the header.

`ColumnObject` now keeps a separate `max_dynamic_paths_upper_bound` that
`prepareForSquashing` restores `max_dynamic_paths` to, and the new
`IColumn::takeDynamicStructureLimitsFrom` carries that bound from the parsed
data over to the columns aggregating it. `global_max_dynamic_paths` is left
alone on purpose: it takes part in `getName`/`structureEquals`, so narrowing it
would make a column mismatch the header built from its own type.

Fixes two cases:
- an asynchronous insert stored more dynamic paths than the setting allows;
- a synchronous insert whose data was split into several blocks kept the limit
  only when the first block happened to overflow into shared data, because
  `prepareForSquashing` raised the limit back whenever shared data was empty.

Closes: #115319

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`max_dynamic_subcolumns_in_json_type_parsing` was applied only to the column a
JSON value is parsed into, so an object nested inside a dynamic path kept the
limit of its inferred type instead. Apply it in `ObjectJSONNode`, the single
place every object goes through during parsing, so it holds at any nesting
depth.

Replace `takeExactDynamicStructureFrom` and `takeDynamicStructureLimitsFrom`
with one implementation behind two wrappers: both copy the dynamic structure and
its limits, and only the exact one fixes the structure so later inserts cannot
extend it. Copying the structure is what makes a nested limit travel, because
`ColumnDynamic` clones the source's variant column and `cloneEmpty` carries the
limits of a nested `ColumnObject` with it. Aggregation of parsed data now uses
the non-exact variant, which also fixes an asynchronous insert widening the
limit of a nested object while a synchronous one kept it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A limit that `max_dynamic_subcolumns_in_json_type_parsing` puts on a parsed
`ColumnObject` instance now travels with the data: `insertFrom` and
`insertRangeFrom` lower the destination's upper bound to the source's. Since
insertions recurse, the limit also reaches a JSON column nested inside a
`Dynamic` without any per-type plumbing, which is how it survives the
aggregation of an asynchronous insert.

This replaces taking the structure explicitly at the aggregation sites, so
`takeExactDynamicStructureFrom`, the columns implementing it,
`StreamingFormatExecutor` and `AsynchronousInsertQueue` all go back to their
previous form.

Also stop the limit from being discarded by a row that reaches the column
before the first parsed object, such as a row where the field is absent or a
default inserted into a typed path: lowering the limit does not need an empty
column, only that the paths already added fit under it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Reshape async-insert columns from first parsed chunk/block
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default labels Aug 25, 2026
@robot-clickhouse

Copy link
Copy Markdown
Member

Dear @Felixoid, @Avogar, this cherry-pick PR has not been updated for 3d0h53m24s. Please resolve the conflicts to backport #115329, or close this PR if the backport is no longer needed. This PR will be automatically closed after 7 days of inactivity.

@robot-ch-test-poll3

Copy link
Copy Markdown
Contributor

Dear @Felixoid, @Avogar, this cherry-pick PR has not been updated for 7d0h11m21s. Closing automatically. If you still want to backport #115329, please resolve the conflicts and reopen this PR.

@robot-ch-test-poll2

Copy link
Copy Markdown
Contributor

Dear @Felixoid, @Avogar, this PR is opened while #115329 was marked as backported. The pr-backports-created is removed, so the original PR can be processed again.

If the cherry-pick is not needed anymore, then just close this PR.

1 similar comment
@robot-clickhouse-ci-2

Copy link
Copy Markdown
Contributor Author

Dear @Felixoid, @Avogar, this PR is opened while #115329 was marked as backported. The pr-backports-created is removed, so the original PR can be processed again.

If the cherry-pick is not needed anymore, then just close this PR.

@robot-ch-test-poll4

Copy link
Copy Markdown
Contributor

Dear @Felixoid, @Avogar, this PR is opened while #115329 was marked as backported. The pr-backports-created is removed, so the original PR can be processed again.

If the cherry-pick is not needed anymore, then just close this PR.

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

Labels

do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants