Skip to content

Revert "Enable sparse serialization independently for typed paths declared inside JSON columns." - #133486

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/revert-111429
Nov 22, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/revert-111429

Conversation

@groeneai

@groeneai groeneai commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Reverts #111429

Related: #133480
Related: #111429

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Description

#111429 introduced a server crash (SIGSEGV on a text-format INSERT, e.g. from file(..., JSONEachRow), into a MergeTree JSON column with serialization_info_version = 'with_subcolumns' once a part stores a typed path as Sparse), reported in #133480. The reproducer crashes at the merge commit b6f0aca and not at its first parent 711cfda (amd_binary builds, 5/5 vs 0/10 runs) and still crashes on master 903285f. At 711cfda CREATE TABLE rejects with_subcolumns, because #111429 adds it. The alternative is a forward fix that keeps sparse typed-path hints away from the JSON text parser, as suggested in #133480.

Proof

merge-attribution.py prove, CI amd_binary builds, clickhouse local, GIT_HASH verified for each build:

Build sha Runs SIGSEGV
merge commit b6f0aca 5 5
first parent 711cfda 10 0 (Code: 36 at CREATE TABLE)
master 903285f 5 4 (5th: Too large size passed to allocator)

Frames: ColumnString::insertData <- StringNode::insertResultToColumn (JSONExtractTree.cpp:501) <- ObjectJSONNode::traverseAndInsert <- SerializationJSON::deserializeObject <- JSONEachRowRowInputFormat::readField. With with_missing_columns the same script gives the correct result on all three builds.

On this revert (debug build): the reproducer stops at CREATE TABLE with Code: 36 in 10/10 runs, the with_missing_columns control is correct 3/3, the three restored gtest files pass, and 16 related sparse/JSON stateless tests pass (03251_insert_sparse_all_formats fails only its AvroConfluent row, identically on master before #111429: no schema registry on my box).

CREATE TABLE t (id UInt64, j JSON(x String, max_dynamic_paths = 0)) ENGINE = MergeTree ORDER BY id
SETTINGS serialization_info_version = 'with_subcolumns', ratio_of_defaults_for_sparse_serialization = 0.9;
INSERT INTO t SELECT number, if(number = 0, '{"x":"a"}', '{}') FROM numbers(100);
INSERT INTO FUNCTION file('t.jsonl', JSONEachRow)
SELECT 100 + number AS id, if(number = 0, '{"x":"b"}', '{}')::JSON(x String, max_dynamic_paths = 0) AS j FROM numbers(2);
INSERT INTO t SELECT * FROM file('t.jsonl', JSONEachRow, 'id UInt64, j JSON(x String, max_dynamic_paths = 0)')
SETTINGS enable_parsing_to_custom_serialization = 1;

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/133486]

Version info

  • Merged into: 26.12.1.170-master (included in 26.12 and later)

…parse-json-typed-paths"

This reverts commit b6f0aca, reversing
changes made to 711cfda.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (click to expand)

Pure revert of #111429: re-applying its diff (711cfda77f97...b6f0acabb16d) to this head gives the tree of master 903285f exactly. Second-model review: 1 finding, not blocking: the revert removes the reader for serialization.json version 3, so a part written with serialization_info_version = 'with_subcolumns' by a master build since the merge does not load after it. No release branch or tag contains #111429, and the value is opt-in (the default stays with_types).

@mintlify

mintlify Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit f3aeef6.

Approve preview

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov, could you review this? This reverts #111429, which crashes the server on a text-format INSERT into a JSON column whose typed path is stored as Sparse (issue #133480): the reproducer crashes at b6f0aca and not at 711cfda.

@clickhouse-gh

clickhouse-gh Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f3aeef6]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added pr-not-for-changelog This PR should not be mentioned in the changelog can be tested Allows running workflows for external contributors comp-json-datatype JSON/Dynamic/Object datatype: semi-structured column storage, typed and dynamic paths, sub-object... labels Nov 22, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 22, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

@groeneai, after this is merged, submit a revert-of-revert PR, but with relevant fixes.

Merged via the queue into ClickHouse:master with commit fff0c72 Nov 22, 2026
577 of 579 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 22, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Acknowledged. I'm preparing the re-land of #111429 with a fix for the crash in #133480; I'll follow up here with the PR link (or my findings) shortly.

@groeneai

Copy link
Copy Markdown
Collaborator Author

Opened #133564: the revert-of-revert of #111429 plus a fix for #133480. The fix caps the version of MergeTreeData::buildSerializationHints at with_missing_columns, so input formats never get a sparse JSON typed path to parse into; written parts still choose Sparse for typed paths from their data. A new test covers the reproducer from #133480 with JSONEachRow, TSV, JSON inside a Tuple, and a Tuple typed path. I found no other new master failure caused by #111429 while it was merged.

alexey-milovidov added a commit that referenced this pull request Nov 25, 2026
…y-serialization

Conflict resolution:

- `master` reverted the sparse serialization of `JSON` typed paths
  (#133486 reverting
  #111429), which removed
  `SerializationInfoNamed` and `SerializationInfoObject`. The `checkKindStacks`
  and `checkKindStackForType` overrides move back to `SerializationInfoTuple`,
  the ones of `SerializationInfoObject` are dropped together with the class,
  and `MutateTask` uses `canUseSparseSerialization` again instead of the
  removed `shouldCollectSerializationInfo`.
- `NativeWriter::getSerializationAndColumn`: keep the materialization of
  non-native `LowCardinality` columns for old peers on top of the reverted code.
- `tryGetSerializationHints` now takes the metadata snapshot
  (#133300): pass it through
  in the overrides this branch adds for the wrapper storages.
- `tests/parallel_replicas_plan_based_blacklist.txt`: `master` removed the whole
  `UNIQUE KEY` section, because plan-based parallel replicas now keep such reads
  local (#133744), so
  `05449_auto_low_cardinality_serialization_unique_key` is not listed anymore.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-json-datatype JSON/Dynamic/Object datatype: semi-structured column storage, typed and dynamic paths, sub-object... pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants