From 406f7a2bfee32d6bd1bdf16fa107cccb1451a464 Mon Sep 17 00:00:00 2001 From: Nikita Mikhaylov Date: Thu, 1 Aug 2019 14:11:08 +0300 Subject: [PATCH] done --- dbms/src/Interpreters/QueryLog.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/dbms/src/Interpreters/QueryLog.cpp b/dbms/src/Interpreters/QueryLog.cpp index 2bc49c42b4b..b04de2fe273 100644 --- a/dbms/src/Interpreters/QueryLog.cpp +++ b/dbms/src/Interpreters/QueryLog.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -20,11 +21,23 @@ namespace DB { +template <> struct NearestFieldTypeImpl { using Type = UInt64; }; + Block QueryLogElement::createBlock() { + + auto query_status_datatype = std::make_shared( + DataTypeEnum8::Values + { + {"QUERY_START", static_cast(QUERY_START)}, + {"QUERY_FINISH", static_cast(QUERY_FINISH)}, + {"EXCEPTION_BEFORE_START", static_cast(EXCEPTION_BEFORE_START)}, + {"EXCEPTION_WHILE_PROCESSING", static_cast(EXCEPTION_WHILE_PROCESSING)} + }); + return { - {std::make_shared(), "type"}, + {std::move(query_status_datatype), "type"}, {std::make_shared(), "event_date"}, {std::make_shared(), "event_time"}, {std::make_shared(), "query_start_time"}, @@ -80,7 +93,7 @@ void QueryLogElement::appendToBlock(Block & block) const size_t i = 0; - columns[i++]->insert(UInt64(type)); + columns[i++]->insert(type); columns[i++]->insert(DateLUT::instance().toDayNum(event_time)); columns[i++]->insert(event_time); columns[i++]->insert(query_start_time);