dbms: system.dictionaries: use ext::map for the purpose it was designed for. [#METR-15569]

This commit is contained in:
Andrey Mironov 2015-03-26 17:57:41 +03:00
parent a369f43e2e
commit 72b2c63557

View File

@ -10,6 +10,7 @@
#include <DB/Dictionaries/IDictionary.h> #include <DB/Dictionaries/IDictionary.h>
#include <DB/Dictionaries/IDictionarySource.h> #include <DB/Dictionaries/IDictionarySource.h>
#include <DB/Dictionaries/DictionaryStructure.h> #include <DB/Dictionaries/DictionaryStructure.h>
#include <statdaemons/ext/map.hpp>
#include <mutex> #include <mutex>
namespace DB namespace DB
@ -87,15 +88,12 @@ BlockInputStreams StorageSystemDictionaries::read(
col_origin.column->insert(dict_info.second.second); col_origin.column->insert(dict_info.second.second);
const auto & dict_struct = dict_ptr->getStructure(); const auto & dict_struct = dict_ptr->getStructure();
Array attribute_names; col_attribute_names.column->insert(ext::map<Array>(dict_struct.attributes, [] (auto & attr) -> decltype(auto) {
Array attribute_types; return attr.name;
for (const auto & attribute : dict_struct.attributes) }));
{ col_attribute_types.column->insert(ext::map<Array>(dict_struct.attributes, [] (auto & attr) -> decltype(auto) {
attribute_names.push_back(attribute.name); return attr.type->getName();
attribute_types.push_back(attribute.type->getName()); }));
}
col_attribute_names.column->insert(attribute_names);
col_attribute_types.column->insert(attribute_types);
col_has_hierarchy.column->insert(UInt64{dict_ptr->hasHierarchy()}); col_has_hierarchy.column->insert(UInt64{dict_ptr->hasHierarchy()});
col_bytes_allocated.column->insert(dict_ptr->getBytesAllocated()); col_bytes_allocated.column->insert(dict_ptr->getBytesAllocated());
col_hit_rate.column->insert(dict_ptr->getHitRate()); col_hit_rate.column->insert(dict_ptr->getHitRate());