diff --git a/src/Dictionaries/CacheDictionary.cpp b/src/Dictionaries/CacheDictionary.cpp index baae02d6990..8225efdd59c 100644 --- a/src/Dictionaries/CacheDictionary.cpp +++ b/src/Dictionaries/CacheDictionary.cpp @@ -142,7 +142,7 @@ void CacheDictionary::toParent(const PaddedPODArray out.assign(values.getData()); } else - throw Exception(); + throw Exception("Hierarchy is not supported for complex key CacheDictionary", ErrorCodes::UNSUPPORTED_METHOD); } @@ -437,6 +437,7 @@ ColumnUInt8::Ptr CacheDictionary::hasKeys(const Columns & k DictionaryKeysExtractor extractor(key_columns); const auto & keys = extractor.getKeys(); + /// We make empty request just to fetch if keys exists DictionaryStorageFetchRequest request(dict_struct, {}); FetchResult result_of_fetch_from_storage; @@ -702,7 +703,6 @@ void CacheDictionary::update(CacheDictionaryUpdateUnitPtrinsertColumnsForKeys(keys, block_columns); - found_num += keys.size(); for (size_t index_of_attribute = 0; index_of_attribute < update_unit_ptr->fetched_columns_during_update.size(); ++index_of_attribute) { @@ -715,14 +715,14 @@ void CacheDictionary::update(CacheDictionaryUpdateUnitPtrrequested_keys_to_fetched_columns_during_update_index[fetched_key_from_source] = i; + size_t column_offset = found_num; + update_unit_ptr->requested_keys_to_fetched_columns_during_update_index[fetched_key_from_source] = column_offset + i; } - // std::cerr << std::endl; + + found_num += keys.size(); } stream->readSuffix(); diff --git a/tests/queries/0_stateless/01681_cache_dictionary_simple_key.reference b/tests/queries/0_stateless/01681_cache_dictionary_simple_key.reference index 12d8cc94f30..b3258e36f74 100644 --- a/tests/queries/0_stateless/01681_cache_dictionary_simple_key.reference +++ b/tests/queries/0_stateless/01681_cache_dictionary_simple_key.reference @@ -61,7 +61,6 @@ dictGet 1 1 2 -dictIsIn dictGetHierarchy [1] [4,2,1] diff --git a/tests/queries/0_stateless/01681_cache_dictionary_simple_key.sql b/tests/queries/0_stateless/01681_cache_dictionary_simple_key.sql index fe5899953f7..ee2cde963d7 100644 --- a/tests/queries/0_stateless/01681_cache_dictionary_simple_key.sql +++ b/tests/queries/0_stateless/01681_cache_dictionary_simple_key.sql @@ -113,15 +113,6 @@ LAYOUT(CACHE(SIZE_IN_CELLS 10)); SELECT 'Dictionary cache_dictionary_simple_key_hierarchy'; SELECT 'dictGet'; SELECT dictGet('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', 'parent_id', number) FROM system.numbers LIMIT 5; -SELECT 'dictIsIn'; --- SELECT 'Check [1] in [0, 1, 2]'; --- SELECT dictIsIn('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([1])), toUInt64(arrayJoin([0, 1, 2]))); --- SELECT 'Check [2] in [0, 1, 2]'; --- SELECT dictIsIn('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([2])), toUInt64(arrayJoin([0, 1, 2]))); --- SELECT 'Check [3] in [0, 1, 2]'; --- SELECT dictIsIn('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([3])), toUInt64(arrayJoin([0, 1, 2]))); --- SELECT 'Check [3, 4] in [0, 1, 2]'; --- SELECT dictIsIn('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([3, 4])), toUInt64(arrayJoin([0, 1, 2]))); SELECT 'dictGetHierarchy'; SELECT dictGetHierarchy('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(1)); SELECT dictGetHierarchy('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(4)); diff --git a/tests/queries/0_stateless/01683_flat_dictionary.reference b/tests/queries/0_stateless/01683_flat_dictionary.reference index 1e822105908..b2a24a01738 100644 --- a/tests/queries/0_stateless/01683_flat_dictionary.reference +++ b/tests/queries/0_stateless/01683_flat_dictionary.reference @@ -53,26 +53,6 @@ dictGet 1 1 2 -dictIsIn -Check [1] in [0, 1, 2] -0 -1 -0 -Check [2] in [0, 1, 2] -0 -1 -1 -Check [3] in [0, 1, 2] -0 -1 -0 -Check [3, 4] in [0, 1, 2] -0 -1 -0 -1 -1 -1 dictGetHierarchy [1] [4,2,1] diff --git a/tests/queries/0_stateless/01683_flat_dictionary.sql b/tests/queries/0_stateless/01683_flat_dictionary.sql index 47305577ae2..16e22c0aa43 100644 --- a/tests/queries/0_stateless/01683_flat_dictionary.sql +++ b/tests/queries/0_stateless/01683_flat_dictionary.sql @@ -109,15 +109,6 @@ LAYOUT(CACHE(SIZE_IN_CELLS 10)); SELECT 'Dictionary flat_dictionary_simple_key_hierarchy'; SELECT 'dictGet'; SELECT dictGet('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', 'parent_id', number) FROM system.numbers LIMIT 5; -SELECT 'dictIsIn'; -SELECT 'Check [1] in [0, 1, 2]'; -SELECT dictIsIn('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([1])), toUInt64(arrayJoin([0, 1, 2]))); -SELECT 'Check [2] in [0, 1, 2]'; -SELECT dictIsIn('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([2])), toUInt64(arrayJoin([0, 1, 2]))); -SELECT 'Check [3] in [0, 1, 2]'; -SELECT dictIsIn('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([3])), toUInt64(arrayJoin([0, 1, 2]))); -SELECT 'Check [3, 4] in [0, 1, 2]'; -SELECT dictIsIn('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([3, 4])), toUInt64(arrayJoin([0, 1, 2]))); SELECT 'dictGetHierarchy'; SELECT dictGetHierarchy('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', toUInt64(1)); SELECT dictGetHierarchy('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', toUInt64(4)); diff --git a/tests/queries/0_stateless/01684_ssd_cache_dictionary_simple_key.reference b/tests/queries/0_stateless/01684_ssd_cache_dictionary_simple_key.reference index 12d8cc94f30..b3258e36f74 100644 --- a/tests/queries/0_stateless/01684_ssd_cache_dictionary_simple_key.reference +++ b/tests/queries/0_stateless/01684_ssd_cache_dictionary_simple_key.reference @@ -61,7 +61,6 @@ dictGet 1 1 2 -dictIsIn dictGetHierarchy [1] [4,2,1] diff --git a/tests/queries/0_stateless/01684_ssd_cache_dictionary_simple_key.sql b/tests/queries/0_stateless/01684_ssd_cache_dictionary_simple_key.sql index df57809ec2a..78d2a623368 100644 --- a/tests/queries/0_stateless/01684_ssd_cache_dictionary_simple_key.sql +++ b/tests/queries/0_stateless/01684_ssd_cache_dictionary_simple_key.sql @@ -113,15 +113,6 @@ LAYOUT(SSD_CACHE(BLOCK_SIZE 4096 FILE_SIZE 8192 PATH '/home/maksim-kita/ClickHou SELECT 'Dictionary cache_dictionary_simple_key_hierarchy'; SELECT 'dictGet'; SELECT dictGet('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', 'parent_id', number) FROM system.numbers LIMIT 5; -SELECT 'dictIsIn'; --- SELECT 'Check [1] in [0, 1, 2]'; --- SELECT dictIsIn('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([1])), toUInt64(arrayJoin([0, 1, 2]))); --- SELECT 'Check [2] in [0, 1, 2]'; --- SELECT dictIsIn('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([2])), toUInt64(arrayJoin([0, 1, 2]))); --- SELECT 'Check [3] in [0, 1, 2]'; --- SELECT dictIsIn('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([3])), toUInt64(arrayJoin([0, 1, 2]))); --- SELECT 'Check [3, 4] in [0, 1, 2]'; --- SELECT dictIsIn('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([3, 4])), toUInt64(arrayJoin([0, 1, 2]))); SELECT 'dictGetHierarchy'; SELECT dictGetHierarchy('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(1)); SELECT dictGetHierarchy('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(4));