1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #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;
- }
- }
- }
|