-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathAggregateFunctionAny.cpp
41 lines (33 loc) · 1.93 KB
/
AggregateFunctionAny.cpp
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
31
32
33
34
35
36
37
38
39
40
41
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Streaming/AggregateFunctionMinMaxAny.h>
#include <AggregateFunctions/Streaming/HelpersMinMaxAny.h>
#include <string>
namespace DB
{
namespace Streaming
{
AggregateFunctionPtr createAggregateFunctionAnyLast(
const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings * settings)
{
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyLastData>(
name, argument_types, parameters, settings));
}
AggregateFunctionPtr
createAggregateFunctionAny(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings * settings)
{
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyData>(
name, argument_types, parameters, settings));
}
void registerAggregateFunctionsAnyRetract(AggregateFunctionFactory & factory)
{
/// FIXME:actually there is no retraction at all, we just ignore the data whose delta is -1
AggregateFunctionProperties properties = {.returns_default_when_only_null = false, .is_order_dependent = true};
factory.registerFunction("any_last_retract", {createAggregateFunctionAnyLast, properties});
factory.registerFunction("any_retract", {createAggregateFunctionAny, properties});
factory.registerFunction("first_value_retract", {createAggregateFunctionAny, properties}, AggregateFunctionFactory::CaseInsensitive);
factory.registerFunction("last_value_retract", {createAggregateFunctionAnyLast, properties}, AggregateFunctionFactory::CaseInsensitive);
factory.registerFunction("earliest_retract", {createAggregateFunctionAny, properties}, AggregateFunctionFactory::CaseInsensitive);
factory.registerFunction("latest_retract", {createAggregateFunctionAnyLast, properties}, AggregateFunctionFactory::CaseInsensitive);
}
}
}