Merge pull request #72226 from ClickHouse/vdimir/fix72174

Fix assert failure in SimpleSquashingChunksTransform
This commit is contained in:
Vladimir Cherkasov 2024-11-25 09:18:46 +00:00 committed by GitHub
commit 6c1e44a82d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 1 deletions

View File

@ -145,7 +145,19 @@ Chunk Squashing::squash(std::vector<Chunk> && input_chunks, Chunk::ChunkInfoColl
auto columns = input_chunks[i].detachColumns();
for (size_t j = 0; j != num_columns; ++j)
{
have_same_serialization[j] &= ISerialization::getKind(*columns[j]) == ISerialization::getKind(*mutable_columns[j]);
/// IColumn::structureEquals is not implemented for deprecated object type, ignore it and always convert to non-sparse.
bool has_object_deprecated = columns[j]->getDataType() == TypeIndex::ObjectDeprecated ||
mutable_columns[j]->getDataType() == TypeIndex::ObjectDeprecated;
auto has_object_deprecated_lambda = [&has_object_deprecated](const auto & subcolumn)
{
has_object_deprecated = has_object_deprecated || subcolumn.getDataType() == TypeIndex::ObjectDeprecated;
};
columns[j]->forEachSubcolumnRecursively(has_object_deprecated_lambda);
mutable_columns[j]->forEachSubcolumnRecursively(has_object_deprecated_lambda);
/// Need to check if there are any sparse columns in subcolumns,
/// since `IColumn::isSparse` is not recursive but sparse column can be inside a tuple, for example.
have_same_serialization[j] &= !has_object_deprecated && columns[j]->structureEquals(*mutable_columns[j]);
source_columns_list[j].emplace_back(std::move(columns[j]));
}
}

View File

@ -0,0 +1,18 @@
DROP TABLE IF EXISTS t0;
DROP TABLE IF EXISTS t1;
SET max_insert_block_size = 1;
SET min_insert_block_size_rows = 1;
SET min_insert_block_size_bytes = 1;
CREATE TABLE t0 (x UInt64, y Tuple(UInt64, UInt64) ) ENGINE = MergeTree ORDER BY x SETTINGS ratio_of_defaults_for_sparse_serialization = 0.5;
SYSTEM STOP MERGES t0;
INSERT INTO t0 SELECT if(number % 2 = 0, 0, number) as x, (x, 0) from numbers(200) SETTINGS max_block_size = 1;
CREATE TABLE t1 (x UInt64, y Tuple(UInt64, UInt64) ) ENGINE = MergeTree ORDER BY x;
SET min_joined_block_size_bytes = 100;
SET join_algorithm = 'parallel_hash';
SELECT sum(ignore(*)) FROM t0 a FULL JOIN t1 b ON a.x = b.x FORMAT Null;