ClickHouse

Форк
0
/
AggregateFunctionCount.cpp 
43 строки · 1.3 Кб
1
#include <AggregateFunctions/AggregateFunctionFactory.h>
2
#include <AggregateFunctions/AggregateFunctionCount.h>
3
#include <AggregateFunctions/FactoryHelpers.h>
4

5

6
namespace DB
7
{
8

9
namespace ErrorCodes
10
{
11
    extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
12
}
13

14
struct Settings;
15

16
AggregateFunctionPtr AggregateFunctionCount::getOwnNullAdapter(
17
    const AggregateFunctionPtr &, const DataTypes & types, const Array & params, const AggregateFunctionProperties & /*properties*/) const
18
{
19
    return std::make_shared<AggregateFunctionCountNotNullUnary>(types[0], params);
20
}
21

22
namespace
23
{
24

25
AggregateFunctionPtr createAggregateFunctionCount(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
26
{
27
    assertNoParameters(name, parameters);
28

29
    if (argument_types.size() > 1)
30
        throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Aggregate function {} requires zero or one argument", name);
31

32
    return std::make_shared<AggregateFunctionCount>(argument_types);
33
}
34

35
}
36

37
void registerAggregateFunctionCount(AggregateFunctionFactory & factory)
38
{
39
    AggregateFunctionProperties properties = { .returns_default_when_only_null = true, .is_order_dependent = false };
40
    factory.registerFunction("count", {createAggregateFunctionCount, properties}, AggregateFunctionFactory::CaseInsensitive);
41
}
42

43
}
44

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.