mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
Merge pull request #45987 from CurtizJ/fix-sparse-columns-crash
Fix `INTERSECT` and `EXCEPT` with sparse columns
This commit is contained in:
commit
3ad5a085da
@ -124,6 +124,8 @@ size_t IntersectOrExceptTransform::buildFilter(
|
||||
|
||||
void IntersectOrExceptTransform::accumulate(Chunk chunk)
|
||||
{
|
||||
convertToFullIfSparse(chunk);
|
||||
|
||||
auto num_rows = chunk.getNumRows();
|
||||
auto columns = chunk.detachColumns();
|
||||
|
||||
@ -160,6 +162,8 @@ void IntersectOrExceptTransform::accumulate(Chunk chunk)
|
||||
|
||||
void IntersectOrExceptTransform::filter(Chunk & chunk)
|
||||
{
|
||||
convertToFullIfSparse(chunk);
|
||||
|
||||
auto num_rows = chunk.getNumRows();
|
||||
auto columns = chunk.detachColumns();
|
||||
|
||||
|
@ -0,0 +1,2 @@
|
||||
0
|
||||
2000
|
14
tests/queries/0_stateless/02552_sparse_columns_intersect.sql
Normal file
14
tests/queries/0_stateless/02552_sparse_columns_intersect.sql
Normal file
@ -0,0 +1,14 @@
|
||||
DROP TABLE IF EXISTS t_sparse_intersect;
|
||||
|
||||
CREATE TABLE t_sparse_intersect (a UInt64, c Int64) ENGINE = MergeTree
|
||||
ORDER BY tuple() SETTINGS ratio_of_defaults_for_sparse_serialization = 0.8;
|
||||
|
||||
SYSTEM STOP MERGES t_sparse_intersect;
|
||||
|
||||
INSERT INTO t_sparse_intersect SELECT if (number % 10 = 0, number, 0), number FROM numbers(1000);
|
||||
INSERT INTO t_sparse_intersect SELECT number, number FROM numbers(1000);
|
||||
|
||||
SELECT count() FROM (SELECT * FROM t_sparse_intersect EXCEPT SELECT * FROM t_sparse_intersect);
|
||||
SELECT count() FROM (SELECT * FROM t_sparse_intersect INTERSECT SELECT * FROM t_sparse_intersect);
|
||||
|
||||
DROP TABLE t_sparse_intersect;
|
Loading…
Reference in New Issue
Block a user