ClickHouse/src/Storages/System/StorageSystemMergeTreeSettings.cpp
Ivan 495c6e03aa
Replace all Context references with std::weak_ptr (#22297)
* Replace all Context references with std::weak_ptr

* Fix shared context captured by value

* Fix build

* Fix Context with named sessions

* Fix copy context

* Fix gcc build

* Merge with master and fix build

* Fix gcc-9 build
2021-04-11 02:33:54 +03:00

39 lines
1.3 KiB
C++

#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypesNumber.h>
#include <Interpreters/Context.h>
#include <Storages/System/StorageSystemMergeTreeSettings.h>
namespace DB
{
template <bool replicated>
NamesAndTypesList SystemMergeTreeSettings<replicated>::getNamesAndTypes()
{
return {
{"name", std::make_shared<DataTypeString>()},
{"value", std::make_shared<DataTypeString>()},
{"changed", std::make_shared<DataTypeUInt8>()},
{"description", std::make_shared<DataTypeString>()},
{"type", std::make_shared<DataTypeString>()},
};
}
template <bool replicated>
void SystemMergeTreeSettings<replicated>::fillData(MutableColumns & res_columns, ContextPtr context, const SelectQueryInfo &) const
{
const auto & settings = replicated ? context->getReplicatedMergeTreeSettings().all() : context->getMergeTreeSettings().all();
for (const auto & setting : settings)
{
res_columns[0]->insert(setting.getName());
res_columns[1]->insert(setting.getValueString());
res_columns[2]->insert(setting.isValueChanged());
res_columns[3]->insert(setting.getDescription());
res_columns[4]->insert(setting.getTypeName());
}
}
template class SystemMergeTreeSettings<false>;
template class SystemMergeTreeSettings<true>;
}