Repository navigation
Fix filling of missed subcolumns - #66243
Merged
Merged
Conversation
Contributor
|
This is an automated comment for commit 47953da with description of existing statuses. It's updated for the latest CI running ✅ Click here to open a full report in a separate page Successful checks
|
jkartseva
reviewed
Jul 10, 2024
Member
|
@CurtizJ, tests have failed. |
18 tasks
CurtizJ
force-pushed
the
fix-filling-empty-subcolumns
branch
from
August 5, 2024 11:19
25d2d66 to
2d92cd7
Compare
robot-clickhouse
added a commit
that referenced
this pull request
Aug 7, 2024
robot-ch-test-poll1
added a commit
that referenced
this pull request
Aug 7, 2024
Backport #66243 to 24.7: Fix filling of missed subcolumns
antonio2368
reviewed
Oct 9, 2024
| full_requested_columns.emplace_back(name_in_storage, it->getTypeInStorage()); | ||
|
|
||
| if (res_columns[pos]) | ||
| additional_columns.insert({res_columns[pos], it->type, it->name}); |
pull Bot
pushed a commit
to AKJUS/ClickHouse
that referenced
this pull request
Jul 29, 2026
…functions_to_subcolumns optimize_functions_to_subcolumns rewrites isNull(x)/isNotNull(x)/count(x) into reads of the x.null subcolumn. After a metadata-only ALTER MODIFY COLUMN x T -> Nullable(T), parts written before the conversion still store non-nullable data on disk and have no .null substream. The reader treated x.null as a fully-missing column and synthesized it from the storage type Nullable(T), whose default value is NULL, so existing not-null rows were reported as NULL (null-map 1 instead of 0). SELECT x, x.null returned 42, 1 on the same row. This differs from the case handled in ClickHouse#66243, where the whole Nullable column is absent after ADD COLUMN and a null-map of 1 is correct. Here the parent column is physically present, so the null-map for existing rows must be 0, derived from the parent. Fix, in the reader path: - injectRequiredColumnsRecursively: when a requested subcolumn's parent column is present in the part but the part-type lacks that subcolumn, inject the parent full column so it is read and converted to the storage type. - fillMissingColumns: do not default-fill such a subcolumn; leave it for evaluateMissingDefaults, which reads the injected parent, converts it (giving an all-zero null-map for the existing rows) and extracts the subcolumn. Covers Compact and Wide parts, with and without DEFAULT NULL, and isNull / isNotNull / count. Closes: ClickHouse#110555 Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fixed reading of subcolumns after
ALTER ADD COLUMNquery.Fixes #66173.
CI Settings (Only check the boxes if you know what you are doing):