Fix LOGICAL_ERROR in case of Sparse column in INSERT block pushed to non-MT MV#81161
Merged
azat merged 1 commit intoClickHouse:masterfrom Jun 3, 2025
Merged
Conversation
Contributor
CheSema
reviewed
Jun 2, 2025
2fd63a5 to
9710b47
Compare
…non-MT MV
Previosly the following:
create table sparse (key String) engine=MergeTree order by () settings ratio_of_defaults_for_sparse_serialization=0.01;
insert into sparse select ''::String from numbers(100);
create table intermediate (key String) engine=MergeTree order by ();
create table log (key String) engine=Log;
create table log_remote as remote('127.1', currentDatabase(), log);
create materialized view mv_log to log as select * from intermediate;
insert into intermediate select * from sparse;
Lead to:
Code: 49. DB::Exception: Received from localhost:9000. DB::Exception: Bad cast from type DB::ColumnSparse to DB::ColumnString: while pushing to view test_y52fdreq.mv_log. (LOGICAL_ERROR)
The reason is that supportsSparseSerialization() is done only for
the destination INSERT table, but not to all the tables that are pushed
to via materialized views.
Introduce separate transform that will only remove sparseness, and apply
it for each table, including tables that are pushed via MVs.
9710b47 to
1356f23
Compare
CheSema
approved these changes
Jun 3, 2025
azat
added a commit
to azat/ClickHouse
that referenced
this pull request
Aug 26, 2025
Squashing cannot work with different const and non-const blocks, but ClickHouse#81161 removed `MaterializingTransform` before squashing, and so it may lead to crash or "Too large size (18446462643291305296) passed to allocator. It indicates an error." error.
azat
added a commit
to azat/ClickHouse
that referenced
this pull request
Aug 26, 2025
Squashing cannot work with different const and non-const blocks, but ClickHouse#81161 removed `MaterializingTransform` before squashing, and so it may lead to crash or "Too large size (18446462643291305296) passed to allocator. It indicates an error." error.
azat
added a commit
to azat/ClickHouse
that referenced
this pull request
Aug 26, 2025
Squashing cannot work with different const and non-const blocks, but ClickHouse#81161 removed `MaterializingTransform` before squashing, and so it may lead to crash or "Too large size (18446462643291305296) passed to allocator. It indicates an error." error.
azat
added a commit
to azat/ClickHouse
that referenced
this pull request
Aug 26, 2025
Squashing cannot work with different const and non-const blocks, but ClickHouse#81161 removed `MaterializingTransform` before squashing, and so it may lead to crash or "Too large size (18446462643291305296) passed to allocator. It indicates an error." error.
azat
added a commit
to azat/ClickHouse
that referenced
this pull request
Aug 27, 2025
Squashing cannot work with different const and non-const blocks, but ClickHouse#81161 removed `MaterializingTransform` before squashing, and so it may lead to crash or "Too large size (18446462643291305296) passed to allocator. It indicates an error." error.
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):
Fix LOGICAL_ERROR in case of Sparse column in INSERT block pushed to non-MT MV
Previously the following:
Lead to:
The reason is that supportsSparseSerialization() is done only for the destination INSERT table, but not to all the tables that are pushed to via materialized views.
Introduce separate transform that will only remove sparseness, and apply it for each table, including tables that are pushed via MVs.