aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Interpreters/QueryThreadLog.h
diff options
context:
space:
mode:
authorvitalyisaev <vitalyisaev@ydb.tech>2023-11-14 09:58:56 +0300
committervitalyisaev <vitalyisaev@ydb.tech>2023-11-14 10:20:20 +0300
commitc2b2dfd9827a400a8495e172a56343462e3ceb82 (patch)
treecd4e4f597d01bede4c82dffeb2d780d0a9046bd0 /contrib/clickhouse/src/Interpreters/QueryThreadLog.h
parentd4ae8f119e67808cb0cf776ba6e0cf95296f2df7 (diff)
downloadydb-c2b2dfd9827a400a8495e172a56343462e3ceb82.tar.gz
YQ Connector: move tests from yql to ydb (OSS)
Перенос папки с тестами на Коннектор из папки yql в папку ydb (синхронизируется с github).
Diffstat (limited to 'contrib/clickhouse/src/Interpreters/QueryThreadLog.h')
-rw-r--r--contrib/clickhouse/src/Interpreters/QueryThreadLog.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/contrib/clickhouse/src/Interpreters/QueryThreadLog.h b/contrib/clickhouse/src/Interpreters/QueryThreadLog.h
new file mode 100644
index 0000000000..684d7fce53
--- /dev/null
+++ b/contrib/clickhouse/src/Interpreters/QueryThreadLog.h
@@ -0,0 +1,62 @@
+#pragma once
+
+#include <Interpreters/SystemLog.h>
+#include <Interpreters/ClientInfo.h>
+#include <Common/ProfileEvents.h>
+#include <Core/NamesAndTypes.h>
+#include <Core/NamesAndAliases.h>
+
+
+namespace DB
+{
+
+struct QueryThreadLogElement
+{
+ time_t event_time{};
+ Decimal64 event_time_microseconds{};
+ /// When query was attached to current thread
+ time_t query_start_time{};
+ /// same as above but adds microsecond precision
+ Decimal64 query_start_time_microseconds{};
+ /// Real time spent by the thread to execute the query
+ UInt64 query_duration_ms{};
+
+ /// The data fetched from DB in current thread to execute the query
+ UInt64 read_rows{};
+ UInt64 read_bytes{};
+
+ /// The data written to DB
+ UInt64 written_rows{};
+ UInt64 written_bytes{};
+
+ Int64 memory_usage{};
+ Int64 peak_memory_usage{};
+
+ String thread_name;
+ UInt64 thread_id{};
+ UInt64 master_thread_id{};
+
+ String current_database;
+ String query;
+ UInt64 normalized_query_hash{};
+
+ ClientInfo client_info;
+
+ std::shared_ptr<ProfileEvents::Counters::Snapshot> profile_counters;
+
+ static std::string name() { return "QueryThreadLog"; }
+
+ static NamesAndTypesList getNamesAndTypes();
+ static NamesAndAliases getNamesAndAliases();
+ void appendToBlock(MutableColumns & columns) const;
+ static const char * getCustomColumnList() { return nullptr; }
+};
+
+
+class QueryThreadLog : public SystemLog<QueryThreadLogElement>
+{
+ using SystemLog<QueryThreadLogElement>::SystemLog;
+};
+
+
+}