Skip to content

Fix sparse Nullable subcolumn reads from compact parts - #114335

Open
acking-you wants to merge 2 commits into
ClickHouse:masterfrom
acking-you:fix/sparse-nullable-null-map-materialization
Open

acking-you wants to merge 2 commits into
ClickHouse:masterfrom
acking-you:fix/sparse-nullable-null-map-materialization

Conversation

@acking-you

@acking-you acking-you commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Fix server aborts when reading the .null subcolumn of a Nullable column with sparse serialization from a Compact MergeTree part using column-level marks (write_marks_for_substreams_in_compact_parts = false). Materialize the derived null map through the existing lazy leaf creator before applying parent subcolumn creators.

The regression test covers Compact + Sparse + .cmrk3 reads of .null and .size, and remains enabled for parallel-replica runs.

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fix a server crash when reading the .null subcolumn of a sparse Nullable column from Compact MergeTree parts with column-level marks.


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

Sparse Nullable null maps are derived from sparse offsets, but the null-map leaf used a regular subcolumn creator. createFromPath only applies regular creators to ancestors, so compact parts with column-level marks produced a null ColumnPtr and crashed while extracting the .null subcolumn.

Use the existing lazy leaf materialization hook and add a stateless regression test that pins Compact storage, sparse serialization, and column-level marks.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a8d7dcd970

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -0,0 +1,31 @@
-- Tags: no-parallel-replicas, no-random-merge-tree-settings

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep this test enabled for parallel-replica runs

Remove the no-parallel-replicas tag: clickhouse-test skips tagged cases entirely in the ParallelReplicas job (tests/clickhouse-test:2858-2859), while this test neither depends on a local query-plan shape nor uses behavior incompatible with parallel replicas. The runner's automatic mode for otherwise eligible tests only collects statistics and does not execute the query on parallel replicas (tests/clickhouse-test:1765-1777), so this tag unnecessarily removes coverage of the compact-part .null regression.

AGENTS.md reference: AGENTS.md:L143-L143

Useful? React with 👍 / 👎.

@george-larionov george-larionov added the can be tested Allows running workflows for external contributors label Aug 26, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f289eff]

Summary: ❌

job_name test_name status info comment
AST fuzzer (amd_debug, targeted, old_compatibility) FAIL
Logical error: Cannot call function A because is has B arguments but C columns were captured. (STID: 2458-4cb4) FAIL cidb

AI Review

Summary

This PR fixes extraction of the sparse Nullable .null subcolumn from Compact MergeTree parts that use column-level marks by materializing the derived null-map leaf lazily before ancestor subcolumn creators run. The code change matches the failure mode through IDataType::getSubcolumn and ISerialization::createFromPath, and the new stateless test covers the previously uncovered Compact + sparse + write_marks_for_substreams_in_compact_parts = false path. I did not find a remaining correctness issue in the implementation.

PR Metadata
  • Changelog category: Bug Fix is correct for the actual change.
  • Changelog entry: required and close, but it should say exception rather than crash because this path fails as a query error instead of terminating the server.
  • Exact replacement: Fix an exception when reading the .null subcolumn of a sparse Nullable column from Compact MergeTree parts with column-level marks.
Final Verdict
  • ✅ No code blockers or majors found.
  • 💡 One non-blocking changelog wording fix would make the PR metadata accurate.

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Aug 26, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-datatype-wrapper Type modifiers/wrappers (Nullable, LowCardinality, etc.). label Sep 4, 2026
…licas

Remove the unnecessary test exclusion requested in review.

ClickHouse#114335
@maxknv maxknv added the external Author is not a member of the ClickHouse organization label Nov 2, 2026

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

can be tested Allows running workflows for external contributors comp-datatype-wrapper Type modifiers/wrappers (Nullable, LowCardinality, etc.). external Author is not a member of the ClickHouse organization pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants