1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <DataTypes/DataTypeDateTime64.h>
#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypesNumber.h>
#include <Interpreters/FilesystemReadPrefetchesLog.h>
namespace DB
{
NamesAndTypesList FilesystemReadPrefetchesLogElement::getNamesAndTypes()
{
return {
{"event_date", std::make_shared<DataTypeDate>()},
{"event_time", std::make_shared<DataTypeDateTime>()},
{"query_id", std::make_shared<DataTypeString>()},
{"path", std::make_shared<DataTypeString>()},
{"offset", std::make_shared<DataTypeUInt64>()},
{"size", std::make_shared<DataTypeInt64>()},
{"prefetch_submit_time", std::make_shared<DataTypeDateTime64>(6)},
{"priority", std::make_shared<DataTypeInt64>()},
{"prefetch_execution_start_time", std::make_shared<DataTypeDateTime64>(6)},
{"prefetch_execution_end_time", std::make_shared<DataTypeDateTime64>(6)},
{"prefetch_execution_time_us", std::make_shared<DataTypeUInt64>()},
{"state", std::make_shared<DataTypeString>()}, /// Was this prefetch used or we downloaded it in vain?
{"thread_id", std::make_shared<DataTypeUInt64>()},
{"reader_id", std::make_shared<DataTypeString>()},
};
}
void FilesystemReadPrefetchesLogElement::appendToBlock(MutableColumns & columns) const
{
size_t i = 0;
columns[i++]->insert(DateLUT::instance().toDayNum(event_time).toUnderType());
columns[i++]->insert(event_time);
columns[i++]->insert(query_id);
columns[i++]->insert(path);
columns[i++]->insert(offset);
columns[i++]->insert(size);
columns[i++]->insert(std::chrono::duration_cast<std::chrono::microseconds>(prefetch_submit_time.time_since_epoch()).count());
columns[i++]->insert(priority.value);
if (execution_watch)
{
columns[i++]->insert(execution_watch->getStart() / 1000);
columns[i++]->insert(execution_watch->getEnd() / 1000);
columns[i++]->insert(execution_watch->elapsedMicroseconds());
}
else
{
columns[i++]->insertDefault();
columns[i++]->insertDefault();
columns[i++]->insertDefault();
}
columns[i++]->insert(magic_enum::enum_name(state));
columns[i++]->insert(thread_id);
columns[i++]->insert(reader_id);
}
}
|