1#pragma once
2
3#include <DataTypes/DataTypeNullable.h>
4#include <DataTypes/DataTypeNothing.h>
5#include <Columns/IColumn.h>
6#include <AggregateFunctions/IAggregateFunction.h>
7
8
9namespace DB
10{
11
12
13/** Aggregate function that takes arbitrary number of arbitrary arguments and does nothing.
14 */
15class AggregateFunctionNothing final : public IAggregateFunctionHelper<AggregateFunctionNothing>
16{
17public:
18 AggregateFunctionNothing(const DataTypes & arguments, const Array & params)
19 : IAggregateFunctionHelper<AggregateFunctionNothing>(arguments, params) {}
20
21 String getName() const override
22 {
23 return "nothing";
24 }
25
26 DataTypePtr getReturnType() const override
27 {
28 return std::make_shared<DataTypeNullable>(std::make_shared<DataTypeNothing>());
29 }
30
31 void create(AggregateDataPtr) const override
32 {
33 }
34
35 void destroy(AggregateDataPtr) const noexcept override
36 {
37 }
38
39 bool hasTrivialDestructor() const override
40 {
41 return true;
42 }
43
44 size_t sizeOfData() const override
45 {
46 return 0;
47 }
48
49 size_t alignOfData() const override
50 {
51 return 1;
52 }
53
54 void add(AggregateDataPtr, const IColumn **, size_t, Arena *) const override
55 {
56 }
57
58 void merge(AggregateDataPtr, ConstAggregateDataPtr, Arena *) const override
59 {
60 }
61
62 void serialize(ConstAggregateDataPtr, WriteBuffer &) const override
63 {
64 }
65
66 void deserialize(AggregateDataPtr, ReadBuffer &, Arena *) const override
67 {
68 }
69
70 void insertResultInto(ConstAggregateDataPtr, IColumn & to) const override
71 {
72 to.insertDefault();
73 }
74};
75
76}
77