ClickHouse/src/Storages/JoinSettings.cpp

42 lines
903 B
C++
Raw Normal View History

2020-09-15 09:16:10 +00:00
#include <Storages/JoinSettings.h>
#include <Parsers/ASTCreateQuery.h>
#include <Parsers/ASTSetQuery.h>
#include <Parsers/ASTFunction.h>
#include <Common/Exception.h>
namespace DB
{
namespace ErrorCodes
{
extern const int UNKNOWN_SETTING;
2020-09-17 18:24:14 +00:00
}
IMPLEMENT_SETTINGS_TRAITS(joinSettingsTraits, LIST_OF_JOIN_SETTINGS)
2020-09-15 09:16:10 +00:00
void JoinSettings::loadFromQuery(ASTStorage & storage_def)
{
if (storage_def.settings)
{
try
{
applyChanges(storage_def.settings->changes);
}
catch (Exception & e)
{
if (e.code() == ErrorCodes::UNKNOWN_SETTING)
2020-10-26 03:35:57 +00:00
e.addMessage("for storage " + storage_def.engine->name);
throw;
2020-09-15 09:16:10 +00:00
}
}
else
{
auto settings_ast = std::make_shared<ASTSetQuery>();
settings_ast->is_standalone = false;
storage_def.set(storage_def.settings, settings_ast);
}
}
}