blob: 5b4d4bcbd78c862b0a562dd75950285722c9aeab (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include "mkql_block_agg_factory.h"
#include "mkql_block_agg_count.h"
#include "mkql_block_agg_sum.h"
#include "mkql_block_agg_minmax.h"
#include "mkql_block_agg_some.h"
#include <yql/essentials/parser/pg_wrapper/interface/arrow.h>
namespace NKikimr {
namespace NMiniKQL {
struct TAggregatorFactories {
THashMap<TString, std::unique_ptr<IBlockAggregatorFactory>> Factories;
TAggregatorFactories()
{
Factories["count_all"] = MakeBlockCountAllFactory();
Factories["count"] = MakeBlockCountFactory();
Factories["sum"] = MakeBlockSumFactory();
Factories["avg"] = MakeBlockAvgFactory();
Factories["min"] = MakeBlockMinFactory();
Factories["max"] = MakeBlockMaxFactory();
Factories["some"] = MakeBlockSomeFactory();
RegisterPgBlockAggs(Factories);
}
};
const IBlockAggregatorFactory& GetBlockAggregatorFactory(TStringBuf name) {
const auto& f = Singleton<TAggregatorFactories>()->Factories;
TStringBuf left, right;
if (name.TrySplit('#', left, right)) {
name = left;
}
auto it = f.find(name);
if (it == f.end()) {
throw yexception() << "Unsupported block aggregation function: " << name;
}
return *it->second;
}
}
}
|