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

Method getItemsShortCircuitImpl

src/Dictionaries/HashedArrayDictionary.cpp:898–944  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

896template <DictionaryKeyType dictionary_key_type, bool sharded>
897template <typename AttributeType, bool is_nullable, typename ValueSetter>
898void HashedArrayDictionary<dictionary_key_type, sharded>::getItemsShortCircuitImpl(
899 const Attribute & attribute,
900 DictionaryKeysExtractor<dictionary_key_type> & keys_extractor,
901 ValueSetter && set_value,
902 IColumn::Filter & default_mask) const
903{
904 const auto & attribute_containers = std::get<AttributeContainerShardsType<AttributeType>>(attribute.containers);
905 const size_t keys_size = keys_extractor.getKeysSize();
906 default_mask.resize(keys_size);
907 size_t keys_found = 0;
908
909 for (size_t key_index = 0; key_index < keys_size; ++key_index)
910 {
911 auto key = keys_extractor.extractCurrentKey();
912 auto shard = getShard(key);
913 const auto & key_attribute_container = key_attribute.containers[shard];
914 const auto & attribute_container = attribute_containers[shard];
915
916 const auto it = key_attribute_container.find(key);
917
918 if (it != key_attribute_container.end())
919 {
920 size_t element_index = it->getMapped();
921
922 const auto & element = attribute_container[element_index];
923
924 if constexpr (is_nullable)
925 set_value(key_index, element, (*attribute.is_index_null)[shard][element_index]);
926 else
927 set_value(key_index, element, false);
928
929 default_mask[key_index] = 0;
930
931 ++keys_found;
932 }
933 else
934 {
935 default_mask[key_index] = 1;
936 set_value(key_index, AttributeType{}, true);
937 }
938
939 keys_extractor.rollbackCurrentKey();
940 }
941
942 query_count.fetch_add(keys_size, std::memory_order_relaxed);
943 found_count.fetch_add(keys_found, std::memory_order_relaxed);
944}
945
946template <DictionaryKeyType dictionary_key_type, bool sharded>
947template <typename AttributeType, bool is_nullable, typename ValueSetter, typename DefaultValueExtractor>

Callers

nothing calls this directly

Calls 8

extractCurrentKeyMethod · 0.80
rollbackCurrentKeyMethod · 0.80
getKeysSizeMethod · 0.45
resizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
getMappedMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected