#include #if USE_HIVE #include #include #include #include namespace DB { namespace ErrorCodes { extern const int UNKNOWN_SETTING; } IMPLEMENT_SETTINGS_TRAITS(HiveSettingsTraits, LIST_OF_HIVE_SETTINGS) void HiveSettings::loadFromConfig(const String & config_elem, const Poco::Util::AbstractConfiguration & config) { if (!config.has(config_elem)) return; Poco::Util::AbstractConfiguration::Keys config_keys; config.keys(config_elem, config_keys); try { for (const String & key : config_keys) set(key, config.getString(config_elem + "." + key)); } catch (Exception & e) { if (e.code() == ErrorCodes::UNKNOWN_SETTING) e.addMessage("in MergeTree config"); throw; } } void HiveSettings::loadFromQuery(ASTStorage & storage_def) { if (storage_def.settings) { try { applyChanges(storage_def.settings->changes); } catch (Exception & e) { if (e.code() == ErrorCodes::UNKNOWN_SETTING) e.addMessage("for storage " + storage_def.engine->name); throw; } } else { auto settings_ast = std::make_shared(); settings_ast->is_standalone = false; storage_def.set(storage_def.settings, settings_ast); } } } #endif