ClickHouse/src/Storages/System/StorageSystemContributors.cpp
2024-01-12 16:39:22 +01:00

32 lines
824 B
C++

#include "StorageSystemContributors.h"
#include <algorithm>
#include <DataTypes/DataTypeString.h>
#include <Common/thread_local_rng.h>
extern const char * auto_contributors[];
namespace DB
{
ColumnsDescription StorageSystemContributors::getColumnsDescription()
{
return ColumnsDescription
{
{"name", std::make_shared<DataTypeString>(), "Contributor (author) name from git log."},
};
}
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));
}
}