mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Merge pull request #19884 from kitaisreal/bloom-filter-index-crash-fix
BloomFilter index crash fix
This commit is contained in:
commit
f09158de0c
@ -140,7 +140,16 @@ void Set::setHeader(const Block & header)
|
|||||||
ConstNullMapPtr null_map{};
|
ConstNullMapPtr null_map{};
|
||||||
ColumnPtr null_map_holder;
|
ColumnPtr null_map_holder;
|
||||||
if (!transform_null_in)
|
if (!transform_null_in)
|
||||||
|
{
|
||||||
|
/// We convert nullable columns to non nullable we also need to update nullable types
|
||||||
|
for (size_t i = 0; i < set_elements_types.size(); ++i)
|
||||||
|
{
|
||||||
|
data_types[i] = removeNullable(data_types[i]);
|
||||||
|
set_elements_types[i] = removeNullable(set_elements_types[i]);
|
||||||
|
}
|
||||||
|
|
||||||
extractNestedColumnsAndNullMap(key_columns, null_map);
|
extractNestedColumnsAndNullMap(key_columns, null_map);
|
||||||
|
}
|
||||||
|
|
||||||
if (fill_set_elements)
|
if (fill_set_elements)
|
||||||
{
|
{
|
||||||
@ -182,7 +191,7 @@ bool Set::insertFromBlock(const Block & block)
|
|||||||
ConstNullMapPtr null_map{};
|
ConstNullMapPtr null_map{};
|
||||||
ColumnPtr null_map_holder;
|
ColumnPtr null_map_holder;
|
||||||
if (!transform_null_in)
|
if (!transform_null_in)
|
||||||
null_map_holder = extractNestedColumnsAndNullMap(key_columns, null_map);
|
null_map_holder = extractNestedColumnsAndNullMap(key_columns, null_map);
|
||||||
|
|
||||||
/// Filter to extract distinct values from the block.
|
/// Filter to extract distinct values from the block.
|
||||||
ColumnUInt8::MutablePtr filter;
|
ColumnUInt8::MutablePtr filter;
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
NullableTuple with transform_null_in=0
|
||||||
|
NullableTuple with transform_null_in=1
|
||||||
|
NullableColumnFromCast with transform_null_in=0
|
||||||
|
1 test
|
||||||
|
NullableColumnFromCast with transform_null_in=1
|
||||||
|
1 test
|
||||||
|
NullableColumnFromTable with transform_null_in=0
|
||||||
|
1 test
|
||||||
|
NullableColumnFromTable with transform_null_in=1
|
||||||
|
1 test
|
@ -0,0 +1,51 @@
|
|||||||
|
DROP TABLE IF EXISTS bloom_filter_nullable_index;
|
||||||
|
CREATE TABLE bloom_filter_nullable_index
|
||||||
|
(
|
||||||
|
order_key UInt64,
|
||||||
|
str Nullable(String),
|
||||||
|
|
||||||
|
INDEX idx (str) TYPE bloom_filter GRANULARITY 1
|
||||||
|
)
|
||||||
|
ENGINE = MergeTree()
|
||||||
|
ORDER BY order_key SETTINGS index_granularity = 6;
|
||||||
|
|
||||||
|
INSERT INTO bloom_filter_nullable_index VALUES (1, 'test');
|
||||||
|
INSERT INTO bloom_filter_nullable_index VALUES (2, 'test2');
|
||||||
|
|
||||||
|
SELECT 'NullableTuple with transform_null_in=0';
|
||||||
|
SELECT * FROM bloom_filter_nullable_index WHERE str IN
|
||||||
|
(SELECT '1048576', str FROM bloom_filter_nullable_index) SETTINGS transform_null_in = 0;
|
||||||
|
SELECT * FROM bloom_filter_nullable_index WHERE str IN
|
||||||
|
(SELECT '1048576', str FROM bloom_filter_nullable_index) SETTINGS transform_null_in = 0;
|
||||||
|
|
||||||
|
SELECT 'NullableTuple with transform_null_in=1';
|
||||||
|
|
||||||
|
SELECT * FROM bloom_filter_nullable_index WHERE str IN
|
||||||
|
(SELECT '1048576', str FROM bloom_filter_nullable_index) SETTINGS transform_null_in = 1; -- { serverError 20 }
|
||||||
|
|
||||||
|
SELECT * FROM bloom_filter_nullable_index WHERE str IN
|
||||||
|
(SELECT '1048576', str FROM bloom_filter_nullable_index) SETTINGS transform_null_in = 1; -- { serverError 20 }
|
||||||
|
|
||||||
|
|
||||||
|
SELECT 'NullableColumnFromCast with transform_null_in=0';
|
||||||
|
SELECT * FROM bloom_filter_nullable_index WHERE str IN
|
||||||
|
(SELECT cast('test', 'Nullable(String)')) SETTINGS transform_null_in = 0;
|
||||||
|
|
||||||
|
SELECT 'NullableColumnFromCast with transform_null_in=1';
|
||||||
|
SELECT * FROM bloom_filter_nullable_index WHERE str IN
|
||||||
|
(SELECT cast('test', 'Nullable(String)')) SETTINGS transform_null_in = 1;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS nullable_string_value;
|
||||||
|
CREATE TABLE nullable_string_value (value Nullable(String)) ENGINE=TinyLog;
|
||||||
|
INSERT INTO nullable_string_value VALUES ('test');
|
||||||
|
|
||||||
|
SELECT 'NullableColumnFromTable with transform_null_in=0';
|
||||||
|
SELECT * FROM bloom_filter_nullable_index WHERE str IN
|
||||||
|
(SELECT value FROM nullable_string_value) SETTINGS transform_null_in = 0;
|
||||||
|
|
||||||
|
SELECT 'NullableColumnFromTable with transform_null_in=1';
|
||||||
|
SELECT * FROM bloom_filter_nullable_index WHERE str IN
|
||||||
|
(SELECT value FROM nullable_string_value) SETTINGS transform_null_in = 1;
|
||||||
|
|
||||||
|
DROP TABLE nullable_string_value;
|
||||||
|
DROP TABLE bloom_filter_nullable_index;
|
Loading…
Reference in New Issue
Block a user