ClickHouse/src/IO/AsyncReadCounters.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
1017 B
C++
Raw Normal View History

2023-02-07 17:50:31 +00:00
#include <IO/AsyncReadCounters.h>
namespace DB
{
void AsyncReadCounters::dumpToMapColumn(IColumn * column) const
{
auto * column_map = column ? &typeid_cast<DB::ColumnMap &>(*column) : nullptr;
if (!column_map)
return;
auto & offsets = column_map->getNestedColumn().getOffsets();
auto & tuple_column = column_map->getNestedData();
auto & key_column = tuple_column.getColumn(0);
auto & value_column = tuple_column.getColumn(1);
size_t size = 0;
auto load_if_not_empty = [&](const auto & key, const auto & value)
{
if (value)
{
key_column.insert(key);
value_column.insert(value);
++size;
}
};
std::lock_guard lock(mutex);
load_if_not_empty("max_parallel_read_tasks", max_parallel_read_tasks);
load_if_not_empty("max_parallel_prefetch_tasks", max_parallel_prefetch_tasks);
load_if_not_empty("total_prefetch_tasks", total_prefetch_tasks);
offsets.push_back(offsets.back() + size);
}
}