aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/System/StorageSystemContributors.cpp
blob: ed28be2a4ab748a505059290bfda00e77d5ec9b9 (plain) (blame)
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
#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));
}
}