#include #include #include #include #include #include #include #include #include #include namespace DB { NamesAndTypesList AsynchronousInsertLogElement::getNamesAndTypes() { auto type_status = std::make_shared( DataTypeEnum8::Values { {"Ok", static_cast(Status::Ok)}, {"ParsingError", static_cast(Status::ParsingError)}, {"FlushError", static_cast(Status::FlushError)}, }); return { {"event_date", std::make_shared()}, {"event_time", std::make_shared()}, {"event_time_microseconds", std::make_shared(6)}, {"query", std::make_shared()}, {"database", std::make_shared(std::make_shared())}, {"table", std::make_shared(std::make_shared())}, {"format", std::make_shared(std::make_shared())}, {"query_id", std::make_shared()}, {"bytes", std::make_shared()}, {"exception", std::make_shared()}, {"status", type_status}, {"flush_time", std::make_shared()}, {"flush_time_microseconds", std::make_shared(6)}, {"flush_query_id", std::make_shared()}, }; } void AsynchronousInsertLogElement::appendToBlock(MutableColumns & columns) const { size_t i = 0; auto event_date = DateLUT::instance().toDayNum(event_time).toUnderType(); columns[i++]->insert(event_date); columns[i++]->insert(event_time); columns[i++]->insert(event_time_microseconds); const auto & insert_query = assert_cast(*query); columns[i++]->insert(queryToString(insert_query)); if (insert_query.table_id) { columns[i++]->insert(insert_query.table_id.getDatabaseName()); columns[i++]->insert(insert_query.table_id.getTableName()); } else { columns[i++]->insertDefault(); columns[i++]->insertDefault(); } columns[i++]->insert(insert_query.format); columns[i++]->insert(query_id); columns[i++]->insert(bytes); columns[i++]->insert(exception); columns[i++]->insert(status); columns[i++]->insert(flush_time); columns[i++]->insert(flush_time_microseconds); columns[i++]->insert(flush_query_id); } }