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

Method create

src/Dictionaries/DictionaryFactory.cpp:46–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46DictionaryPtr DictionaryFactory::create(
47 const std::string & name,
48 const Poco::Util::AbstractConfiguration & config,
49 const std::string & config_prefix,
50 ContextPtr global_context,
51 bool created_from_ddl) const
52{
53 Poco::Util::AbstractConfiguration::Keys keys;
54 const auto & layout_prefix = config_prefix + ".layout";
55 config.keys(layout_prefix, keys);
56 if (keys.size() != 1)
57 throw Exception(ErrorCodes::EXCESSIVE_ELEMENT_IN_CONFIG,
58 "{}: element dictionary.layout should have exactly one child element",
59 name);
60
61 const DictionaryStructure dict_struct{config, config_prefix};
62
63 DictionarySourcePtr source_ptr = DictionarySourceFactory::instance().create(
64 name, config, config_prefix + ".source", dict_struct, global_context, config.getString(config_prefix + ".database", ""), created_from_ddl);
65 LOG_TRACE(getLogger("DictionaryFactory"), "Created dictionary source '{}' for dictionary '{}'", source_ptr->toString(), name);
66
67 const auto & layout_type = keys.front();
68
69 {
70 const auto found = registered_layouts.find(layout_type);
71 if (found != registered_layouts.end())
72 {
73 const auto & layout_creator = found->second.layout_create_function;
74 return layout_creator(name, dict_struct, config, config_prefix, std::move(source_ptr), global_context, created_from_ddl);
75 }
76 }
77
78 throw Exception(ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG,
79 "{}: unknown dictionary layout type: {}",
80 name,
81 layout_type);
82}
83
84bool DictionaryFactory::isComplex(const std::string & layout_type) const
85{

Callers 5

loadFromQueryMethod · 0.45
loadAllMethod · 0.45
loadUpdatedAllMethod · 0.45
loadIdsMethod · 0.45
loadKeysMethod · 0.45

Calls 9

keysMethod · 0.80
ExceptionClass · 0.50
getLoggerFunction · 0.50
sizeMethod · 0.45
getStringMethod · 0.45
toStringMethod · 0.45
frontMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected