2017-04-01 09:19:00 +00:00
|
|
|
#include <AggregateFunctions/AggregateFunctionFactory.h>
|
|
|
|
#include <DataTypes/DataTypeString.h>
|
|
|
|
#include <DataTypes/DataTypesNumber.h>
|
2018-07-24 14:28:56 +00:00
|
|
|
#include <Functions/FunctionFactory.h>
|
|
|
|
#include <Functions/IFunction.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Interpreters/Context.h>
|
2018-07-24 14:28:56 +00:00
|
|
|
#include <Storages/System/StorageSystemFunctions.h>
|
2016-12-08 02:49:04 +00:00
|
|
|
|
2015-04-24 15:49:30 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2018-07-25 16:08:23 +00:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
template <typename Factory>
|
|
|
|
void fillRow(MutableColumns & res_columns, const String & name, UInt64 is_aggregate, const Factory & f)
|
|
|
|
{
|
|
|
|
res_columns[0]->insert(name);
|
|
|
|
res_columns[1]->insert(is_aggregate);
|
2018-10-22 08:54:54 +00:00
|
|
|
res_columns[2]->insert(f.isCaseInsensitive(name));
|
2018-07-25 16:08:23 +00:00
|
|
|
if (f.isAlias(name))
|
|
|
|
res_columns[3]->insert(f.aliasTo(name));
|
|
|
|
else
|
2018-11-01 17:21:15 +00:00
|
|
|
res_columns[3]->insertDefault();
|
2018-07-25 16:08:23 +00:00
|
|
|
}
|
|
|
|
}
|
2015-04-24 15:49:30 +00:00
|
|
|
|
2018-07-24 14:28:56 +00:00
|
|
|
NamesAndTypesList StorageSystemFunctions::getNamesAndTypes()
|
2018-01-25 14:42:39 +00:00
|
|
|
{
|
2018-07-24 14:28:56 +00:00
|
|
|
return {
|
|
|
|
{"name", std::make_shared<DataTypeString>()},
|
|
|
|
{"is_aggregate", std::make_shared<DataTypeUInt8>()},
|
2018-07-25 16:19:11 +00:00
|
|
|
{"case_insensitive", std::make_shared<DataTypeUInt8>()},
|
2018-07-25 16:08:23 +00:00
|
|
|
{"alias_to", std::make_shared<DataTypeString>()},
|
2018-07-24 14:28:56 +00:00
|
|
|
};
|
2015-04-24 15:49:30 +00:00
|
|
|
}
|
|
|
|
|
2018-07-24 14:28:56 +00:00
|
|
|
void StorageSystemFunctions::fillData(MutableColumns & res_columns, const Context &, const SelectQueryInfo &) const
|
2015-04-24 15:49:30 +00:00
|
|
|
{
|
2018-07-25 16:08:23 +00:00
|
|
|
const auto & functions_factory = FunctionFactory::instance();
|
|
|
|
const auto & function_names = functions_factory.getAllRegisteredNames();
|
|
|
|
for (const auto & name : function_names)
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
2018-07-25 16:08:23 +00:00
|
|
|
fillRow(res_columns, name, UInt64(0), functions_factory);
|
2017-04-01 07:20:54 +00:00
|
|
|
}
|
|
|
|
|
2018-07-25 16:08:23 +00:00
|
|
|
const auto & aggregate_functions_factory = AggregateFunctionFactory::instance();
|
|
|
|
const auto & aggregate_function_names = aggregate_functions_factory.getAllRegisteredNames();
|
|
|
|
for (const auto & name : aggregate_function_names)
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
2018-07-25 16:08:23 +00:00
|
|
|
fillRow(res_columns, name, UInt64(1), aggregate_functions_factory);
|
2017-04-01 07:20:54 +00:00
|
|
|
}
|
2015-04-24 15:49:30 +00:00
|
|
|
}
|
2015-09-24 03:50:09 +00:00
|
|
|
}
|