diff --git a/src/Dictionaries/FlatDictionary.cpp b/src/Dictionaries/FlatDictionary.cpp index def5ae75690..d5c40436aec 100644 --- a/src/Dictionaries/FlatDictionary.cpp +++ b/src/Dictionaries/FlatDictionary.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -249,6 +250,8 @@ void FlatDictionary::blockToAttributes(const Block & block) DictionaryKeysExtractor keys_extractor({ keys_column }, arena_holder.getComplexKeyArena()); auto keys = keys_extractor.extractAllKeys(); + HashSet already_processed_keys; + size_t key_offset = 1; for (size_t attribute_index = 0; attribute_index < attributes.size(); ++attribute_index) { @@ -259,12 +262,15 @@ void FlatDictionary::blockToAttributes(const Block & block) { auto key = keys[i]; - if (key < loaded_keys.size() && loaded_keys[key]) + if (already_processed_keys.find(key) != nullptr) continue; + already_processed_keys.insert(key); setAttributeValue(attribute, key, attribute_column[i]); ++element_count; } + + already_processed_keys.clear(); } }