dbms: OLAP compatibility: fixed error for ███████████.yandex-team.ru [#METR-17929].

This commit is contained in:
Alexey Milovidov 2015-10-09 23:22:33 +03:00
parent 3733ac9ead
commit 31e94fb6cb
3 changed files with 19 additions and 14 deletions

View File

@ -48,7 +48,7 @@ void QueryConverter::OLAPServerQueryToClickHouse(const QueryParseResult & query,
if (query.format != FORMAT_TAB)
throw Exception("Only tab-separated output format is supported", ErrorCodes::UNSUPPORTED_PARAMETER);
/// Учтем некоторые настройки (пока далеко не все).
/// Учтем некоторые настройки (далеко не все).
Settings new_settings = inout_context.getSettings();
@ -61,17 +61,20 @@ void QueryConverter::OLAPServerQueryToClickHouse(const QueryParseResult & query,
if (query.max_result_size != 0)
new_settings.limits.max_rows_to_group_by = query.max_result_size;
switch (query.overflow_mode)
if (query.has_overflow_mode)
{
case OLAP::OVERFLOW_MODE_THROW:
new_settings.limits.group_by_overflow_mode = DB::OverflowMode::THROW;
break;
case OLAP::OVERFLOW_MODE_BREAK:
new_settings.limits.group_by_overflow_mode = DB::OverflowMode::BREAK;
break;
case OLAP::OVERFLOW_MODE_ANY:
new_settings.limits.group_by_overflow_mode = DB::OverflowMode::ANY;
break;
switch (query.overflow_mode)
{
case OLAP::OVERFLOW_MODE_THROW:
new_settings.limits.group_by_overflow_mode = DB::OverflowMode::THROW;
break;
case OLAP::OVERFLOW_MODE_BREAK:
new_settings.limits.group_by_overflow_mode = DB::OverflowMode::BREAK;
break;
case OLAP::OVERFLOW_MODE_ANY:
new_settings.limits.group_by_overflow_mode = DB::OverflowMode::ANY;
break;
}
}
inout_context.setSettings(new_settings);

View File

@ -100,7 +100,6 @@ QueryParseResult QueryParser::parse(std::istream & s)
result.cut_date_last = false;
result.cut_dates_for_goals = false;
result.overflow_mode = OVERFLOW_MODE_THROW;
result.concurrency = 0;
result.max_threads_per_counter = 0;
result.limit = 0;
@ -152,9 +151,10 @@ QueryParseResult QueryParser::parse(std::istream & s)
throw Exception(std::string("Unknown overflow mode: ") + overflow_mode_str,
ErrorCodes::UNKNOWN_OVERFLOW_MODE);
result.has_overflow_mode = true;
result.overflow_mode = overflow_mode_str == "throw" ? OVERFLOW_MODE_THROW
: (overflow_mode_str == "break" ? OVERFLOW_MODE_BREAK
: OVERFLOW_MODE_ANY);
: (overflow_mode_str == "break" ? OVERFLOW_MODE_BREAK
: OVERFLOW_MODE_ANY);
}
else if (settings_child_nodes->item(i)->nodeName() == "concurrency")
{

View File

@ -87,6 +87,8 @@ struct QueryParseResult
float sample;
Format format;
bool has_overflow_mode = false;
OverflowMode overflow_mode;
Poco::AutoPtr<Poco::XML::Document> query;