mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #29474 from kitaisreal/bloom-filter-indexes-updated-tests
Bloom filter indexes updated tests
This commit is contained in:
commit
0279afa738
@ -408,7 +408,6 @@ bool MergeTreeIndexConditionBloomFilter::traverseASTIn(
|
||||
auto element_key = literal->value;
|
||||
const DataTypePtr actual_type = BloomFilter::getPrimitiveType(index_type);
|
||||
out.predicate.emplace_back(std::make_pair(position, BloomFilterHash::hashWithField(actual_type.get(), element_key)));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4,51 +4,51 @@ CREATE TABLE map_test_index_map_keys
|
||||
row_id UInt32,
|
||||
map Map(String, String),
|
||||
INDEX map_bloom_filter_keys mapKeys(map) TYPE bloom_filter GRANULARITY 1
|
||||
) Engine=MergeTree() ORDER BY row_id;
|
||||
) Engine=MergeTree() ORDER BY row_id SETTINGS index_granularity = 1;
|
||||
|
||||
INSERT INTO map_test_index_map_keys VALUES (0, {'K0':'V0'}), (1, {'K1':'V1'});
|
||||
|
||||
SELECT 'Map bloom filter mapKeys';
|
||||
|
||||
SELECT 'Equals with existing key';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K0'] = 'V0';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K0'] = 'V0' SETTINGS force_data_skipping_indices='map_bloom_filter_keys';
|
||||
SELECT 'Equals with non existing key';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K2'] = 'V2';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K2'] = 'V2' SETTINGS force_data_skipping_indices='map_bloom_filter_keys';
|
||||
SELECT 'Equals with non existing key and default value';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K3'] = '';
|
||||
SELECT 'Not equals with existing key';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K0'] != 'V0';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K0'] != 'V0' SETTINGS force_data_skipping_indices='map_bloom_filter_keys';
|
||||
SELECT 'Not equals with non existing key';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K2'] != 'V2';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K2'] != 'V2' SETTINGS force_data_skipping_indices='map_bloom_filter_keys';
|
||||
SELECT 'Not equals with non existing key and default value';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K3'] != '';
|
||||
|
||||
SELECT 'IN with existing key';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K0'] IN 'V0';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K0'] IN 'V0' SETTINGS force_data_skipping_indices='map_bloom_filter_keys';
|
||||
SELECT 'IN with non existing key';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K2'] IN 'V2';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K2'] IN 'V2' SETTINGS force_data_skipping_indices='map_bloom_filter_keys';
|
||||
SELECT 'IN with non existing key and default value';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K3'] IN '';
|
||||
SELECT 'NOT IN with existing key';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K0'] NOT IN 'V0';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K0'] NOT IN 'V0' SETTINGS force_data_skipping_indices='map_bloom_filter_keys';
|
||||
SELECT 'NOT IN with non existing key';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K2'] NOT IN 'V2';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K2'] NOT IN 'V2' SETTINGS force_data_skipping_indices='map_bloom_filter_keys';
|
||||
SELECT 'NOT IN with non existing key and default value';
|
||||
SELECT * FROM map_test_index_map_keys WHERE map['K3'] NOT IN '';
|
||||
|
||||
SELECT 'MapContains with existing key';
|
||||
SELECT * FROM map_test_index_map_keys WHERE mapContains(map, 'K0');
|
||||
SELECT * FROM map_test_index_map_keys WHERE mapContains(map, 'K0') SETTINGS force_data_skipping_indices='map_bloom_filter_keys';
|
||||
SELECT 'MapContains with non existing key';
|
||||
SELECT * FROM map_test_index_map_keys WHERE mapContains(map, 'K2');
|
||||
SELECT * FROM map_test_index_map_keys WHERE mapContains(map, 'K2') SETTINGS force_data_skipping_indices='map_bloom_filter_keys';
|
||||
SELECT 'MapContains with non existing key and default value';
|
||||
SELECT * FROM map_test_index_map_keys WHERE mapContains(map, '');
|
||||
|
||||
SELECT 'Has with existing key';
|
||||
SELECT * FROM map_test_index_map_keys WHERE has(map, 'K0');
|
||||
SELECT * FROM map_test_index_map_keys WHERE has(map, 'K0') SETTINGS force_data_skipping_indices='map_bloom_filter_keys';
|
||||
SELECT 'Has with non existing key';
|
||||
SELECT * FROM map_test_index_map_keys WHERE has(map, 'K2');
|
||||
SELECT * FROM map_test_index_map_keys WHERE has(map, 'K2') SETTINGS force_data_skipping_indices='map_bloom_filter_keys';
|
||||
SELECT 'Has with non existing key and default value';
|
||||
SELECT * FROM map_test_index_map_keys WHERE has(map, '');
|
||||
SELECT * FROM map_test_index_map_keys WHERE has(map, '') SETTINGS force_data_skipping_indices='map_bloom_filter_keys';
|
||||
|
||||
DROP TABLE map_test_index_map_keys;
|
||||
|
||||
@ -58,34 +58,34 @@ CREATE TABLE map_test_index_map_values
|
||||
row_id UInt32,
|
||||
map Map(String, String),
|
||||
INDEX map_bloom_filter_values mapValues(map) TYPE bloom_filter GRANULARITY 1
|
||||
) Engine=MergeTree() ORDER BY row_id;
|
||||
) Engine=MergeTree() ORDER BY row_id SETTINGS index_granularity = 1;
|
||||
|
||||
INSERT INTO map_test_index_map_values VALUES (0, {'K0':'V0'}), (1, {'K1':'V1'});
|
||||
|
||||
SELECT 'Map bloom filter mapValues';
|
||||
|
||||
SELECT 'Equals with existing key';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K0'] = 'V0';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K0'] = 'V0' SETTINGS force_data_skipping_indices='map_bloom_filter_values';
|
||||
SELECT 'Equals with non existing key';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K2'] = 'V2';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K2'] = 'V2' SETTINGS force_data_skipping_indices='map_bloom_filter_values';
|
||||
SELECT 'Equals with non existing key and default value';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K3'] = '';
|
||||
SELECT 'Not equals with existing key';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K0'] != 'V0';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K0'] != 'V0' SETTINGS force_data_skipping_indices='map_bloom_filter_values';
|
||||
SELECT 'Not equals with non existing key';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K2'] != 'V2';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K2'] != 'V2' SETTINGS force_data_skipping_indices='map_bloom_filter_values';
|
||||
SELECT 'Not equals with non existing key and default value';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K3'] != '';
|
||||
SELECT 'IN with existing key';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K0'] IN 'V0';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K0'] IN 'V0' SETTINGS force_data_skipping_indices='map_bloom_filter_values';
|
||||
SELECT 'IN with non existing key';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K2'] IN 'V2';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K2'] IN 'V2' SETTINGS force_data_skipping_indices='map_bloom_filter_values';
|
||||
SELECT 'IN with non existing key and default value';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K3'] IN '';
|
||||
SELECT 'NOT IN with existing key';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K0'] NOT IN 'V0';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K0'] NOT IN 'V0' SETTINGS force_data_skipping_indices='map_bloom_filter_values';
|
||||
SELECT 'NOT IN with non existing key';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K2'] NOT IN 'V2';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K2'] NOT IN 'V2' SETTINGS force_data_skipping_indices='map_bloom_filter_values';
|
||||
SELECT 'NOT IN with non existing key and default value';
|
||||
SELECT * FROM map_test_index_map_values WHERE map['K3'] NOT IN '';
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
1 ['K1 K1'] ['K1 K1']
|
||||
2 ['K2 K2'] ['K2 K2']
|
||||
1 ['K1 K1'] ['K1 K1']
|
||||
2 ['K2 K2'] ['K2 K2']
|
||||
1 ['K1 K1'] ['K1 K1']
|
||||
2 ['K2 K2'] ['K2 K2']
|
||||
1 ['K1 K1'] ['K1 K1']
|
||||
2 ['K2 K2'] ['K2 K2']
|
||||
1 ['K1'] ['K1']
|
||||
2 ['K2'] ['K2']
|
||||
1 ['K1'] ['K1']
|
||||
2 ['K2'] ['K2']
|
||||
1 ['K1'] ['K1']
|
||||
2 ['K2'] ['K2']
|
||||
1 ['K1'] ['K1']
|
||||
2 ['K2'] ['K2']
|
||||
|
@ -5,38 +5,38 @@ CREATE TABLE bf_tokenbf_array_test
|
||||
(
|
||||
row_id UInt32,
|
||||
array Array(String),
|
||||
array_fixed Array(FixedString(5)),
|
||||
array_fixed Array(FixedString(2)),
|
||||
INDEX array_bf_tokenbf array TYPE tokenbf_v1(256,2,0) GRANULARITY 1,
|
||||
INDEX array_fixed_bf_tokenbf array_fixed TYPE tokenbf_v1(256,2,0) GRANULARITY 1
|
||||
) Engine=MergeTree() ORDER BY row_id SETTINGS index_granularity = 2;
|
||||
) Engine=MergeTree() ORDER BY row_id SETTINGS index_granularity = 1;
|
||||
|
||||
CREATE TABLE bf_ngram_array_test
|
||||
(
|
||||
row_id UInt32,
|
||||
array Array(String),
|
||||
array_fixed Array(FixedString(5)),
|
||||
array_fixed Array(FixedString(2)),
|
||||
INDEX array_ngram array TYPE ngrambf_v1(4,256,2,0) GRANULARITY 1,
|
||||
INDEX array_fixed_ngram array_fixed TYPE ngrambf_v1(4,256,2,0) GRANULARITY 1
|
||||
) Engine=MergeTree() ORDER BY row_id SETTINGS index_granularity = 2;
|
||||
) Engine=MergeTree() ORDER BY row_id SETTINGS index_granularity = 1;
|
||||
|
||||
INSERT INTO bf_tokenbf_array_test VALUES (1, ['K1 K1'], ['K1 K1']), (2, ['K2 K2'], ['K2 K2']);
|
||||
INSERT INTO bf_ngram_array_test VALUES (1, ['K1 K1'], ['K1 K1']), (2, ['K2 K2'], ['K2 K2']);
|
||||
INSERT INTO bf_tokenbf_array_test VALUES (1, ['K1'], ['K1']), (2, ['K2'], ['K2']);
|
||||
INSERT INTO bf_ngram_array_test VALUES (1, ['K1'], ['K1']), (2, ['K2'], ['K2']);
|
||||
|
||||
SELECT * FROM bf_tokenbf_array_test WHERE has(array, 'K1 K1');
|
||||
SELECT * FROM bf_tokenbf_array_test WHERE has(array, 'K2 K2');
|
||||
SELECT * FROM bf_tokenbf_array_test WHERE has(array, 'K3 K3');
|
||||
SELECT * FROM bf_tokenbf_array_test WHERE has(array, 'K1') SETTINGS force_data_skipping_indices='array_bf_tokenbf';
|
||||
SELECT * FROM bf_tokenbf_array_test WHERE has(array, 'K2') SETTINGS force_data_skipping_indices='array_bf_tokenbf';
|
||||
SELECT * FROM bf_tokenbf_array_test WHERE has(array, 'K3') SETTINGS force_data_skipping_indices='array_bf_tokenbf';
|
||||
|
||||
SELECT * FROM bf_tokenbf_array_test WHERE has(array_fixed, 'K1 K1');
|
||||
SELECT * FROM bf_tokenbf_array_test WHERE has(array_fixed, 'K2 K2');
|
||||
SELECT * FROM bf_tokenbf_array_test WHERE has(array_fixed, 'K3 K3');
|
||||
SELECT * FROM bf_tokenbf_array_test WHERE has(array_fixed, 'K1') SETTINGS force_data_skipping_indices='array_fixed_bf_tokenbf';
|
||||
SELECT * FROM bf_tokenbf_array_test WHERE has(array_fixed, 'K2') SETTINGS force_data_skipping_indices='array_fixed_bf_tokenbf';
|
||||
SELECT * FROM bf_tokenbf_array_test WHERE has(array_fixed, 'K3') SETTINGS force_data_skipping_indices='array_fixed_bf_tokenbf';
|
||||
|
||||
SELECT * FROM bf_ngram_array_test WHERE has(array, 'K1 K1');
|
||||
SELECT * FROM bf_ngram_array_test WHERE has(array, 'K2 K2');
|
||||
SELECT * FROM bf_ngram_array_test WHERE has(array, 'K3 K3');
|
||||
SELECT * FROM bf_ngram_array_test WHERE has(array, 'K1') SETTINGS force_data_skipping_indices='array_ngram';
|
||||
SELECT * FROM bf_ngram_array_test WHERE has(array, 'K2') SETTINGS force_data_skipping_indices='array_ngram';
|
||||
SELECT * FROM bf_ngram_array_test WHERE has(array, 'K3') SETTINGS force_data_skipping_indices='array_ngram';
|
||||
|
||||
SELECT * FROM bf_ngram_array_test WHERE has(array_fixed, 'K1 K1');
|
||||
SELECT * FROM bf_ngram_array_test WHERE has(array_fixed, 'K2 K2');
|
||||
SELECT * FROM bf_ngram_array_test WHERE has(array_fixed, 'K3 K3');
|
||||
SELECT * FROM bf_ngram_array_test WHERE has(array_fixed, 'K1') SETTINGS force_data_skipping_indices='array_fixed_ngram';
|
||||
SELECT * FROM bf_ngram_array_test WHERE has(array_fixed, 'K2') SETTINGS force_data_skipping_indices='array_fixed_ngram';
|
||||
SELECT * FROM bf_ngram_array_test WHERE has(array_fixed, 'K3') SETTINGS force_data_skipping_indices='array_fixed_ngram';
|
||||
|
||||
DROP TABLE bf_tokenbf_array_test;
|
||||
DROP TABLE bf_ngram_array_test;
|
||||
|
Loading…
Reference in New Issue
Block a user