MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / hasKeys

Method hasKeys

src/Dictionaries/HashedArrayDictionary.cpp:202–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200
201template <DictionaryKeyType dictionary_key_type, bool sharded>
202ColumnUInt8::Ptr HashedArrayDictionary<dictionary_key_type, sharded>::hasKeys(const Columns & key_columns, const DataTypes & key_types) const
203{
204 if (dictionary_key_type == DictionaryKeyType::Complex)
205 dict_struct.validateKeyTypes(key_types);
206
207 DictionaryKeysArenaHolder<dictionary_key_type> arena_holder;
208 DictionaryKeysExtractor<dictionary_key_type> extractor(key_columns, arena_holder.getComplexKeyArena());
209
210 size_t keys_size = extractor.getKeysSize();
211
212 auto result = ColumnUInt8::create(keys_size, false);
213 auto & out = result->getData();
214
215 size_t keys_found = 0;
216
217 for (size_t requested_key_index = 0; requested_key_index < keys_size; ++requested_key_index)
218 {
219 auto requested_key = extractor.extractCurrentKey();
220 auto shard = getShard(requested_key);
221 const auto & key_attribute_container = key_attribute.containers[shard];
222
223 out[requested_key_index] = key_attribute_container.find(requested_key) != key_attribute_container.end();
224
225 keys_found += out[requested_key_index];
226 extractor.rollbackCurrentKey();
227 }
228
229 query_count.fetch_add(keys_size, std::memory_order_relaxed);
230 found_count.fetch_add(keys_found, std::memory_order_relaxed);
231
232 return result;
233}
234
235template <DictionaryKeyType dictionary_key_type, bool sharded>
236ColumnPtr HashedArrayDictionary<dictionary_key_type, sharded>::getHierarchy(ColumnPtr key_column [[maybe_unused]], const DataTypePtr &) const

Callers

nothing calls this directly

Calls 9

validateKeyTypesMethod · 0.80
extractCurrentKeyMethod · 0.80
rollbackCurrentKeyMethod · 0.80
createFunction · 0.50
getComplexKeyArenaMethod · 0.45
getKeysSizeMethod · 0.45
getDataMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected