ClickHouse/src/Storages/System/StorageSystemContributors.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

31 lines
752 B
C++

#include "StorageSystemContributors.h"
#include <algorithm>
#include <DataTypes/DataTypeString.h>
#include <Common/thread_local_rng.h>
extern const char * auto_contributors[];
namespace DB
{
NamesAndTypesList StorageSystemContributors::getNamesAndTypes()
{
return {
{"name", std::make_shared<DataTypeString>()},
};
}
void StorageSystemContributors::fillData(MutableColumns & res_columns, ContextPtr, const SelectQueryInfo &) const
{
std::vector<const char *> contributors;
for (auto * it = auto_contributors; *it; ++it)
contributors.emplace_back(*it);
std::shuffle(contributors.begin(), contributors.end(), thread_local_rng);
for (auto & it : contributors)
res_columns[0]->insert(String(it));
}
}