JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Agg_State.h
Go to the documentation of this file.
1 //
2 // Created by Nico on 08/05/2019.
3 //
4 
5 #ifndef JODA_AGG_STATE_H
6 #define JODA_AGG_STATE_H
7 #include "Query_State.h"
8 
10 
13  AVG,
15  SUM,
18  MIN,
19  MAX,
21  HISTOGRAM
22 };
23 
24 struct aggState {
25  template <typename Input>
26  inline aggState(const Input &in, queryState &qs) {
27  aggfun = NOAGG;
28  }
29 
30  template <typename Input>
31  inline void success(const Input &in, queryState &qs) {
32  for (auto &agg : aggs) {
33  qs.q->addAggregator(std::move(agg));
34  }
35  }
36 
37  inline bool putValProv(std::unique_ptr<joda::query::IValueProvider> &&val) {
38  assert(val != nullptr && "Should not pass nullptr");
39  if (val == nullptr) return false;
40  valprov.push_back(std::move(val));
41  return true;
42  }
43 
44  std::vector<std::unique_ptr<joda::query::IValueProvider>> valprov;
45  std::string toPointer;
47  std::vector<std::unique_ptr<joda::query::IAggregator>> aggs;
48 
49  std::unique_ptr<joda::query::IValueProvider> groupedByValue = nullptr;
50  std::string groupAs{};
51 };
52 } // namespace joda::queryparsing::grammar
53 
54 #endif // JODA_AGG_STATE_H
aggFunction
Definition: Agg_State.h:11
@ COLLECT
Definition: Agg_State.h:20
@ MAX
Definition: Agg_State.h:19
@ HISTOGRAM
Definition: Agg_State.h:21
@ AVG
Definition: Agg_State.h:13
@ MIN
Definition: Agg_State.h:18
@ SUM
Definition: Agg_State.h:15
@ DISTINCT
Definition: Agg_State.h:17
@ COUNT
Definition: Agg_State.h:14
@ ATTSTAT
Definition: Agg_State.h:16
@ NOAGG
Definition: Agg_State.h:12
Definition: Agg_State.h:24
std::string groupAs
Definition: Agg_State.h:50
bool putValProv(std::unique_ptr< joda::query::IValueProvider > &&val)
Definition: Agg_State.h:37
std::vector< std::unique_ptr< joda::query::IValueProvider > > valprov
Definition: Agg_State.h:44
std::vector< std::unique_ptr< joda::query::IAggregator > > aggs
Definition: Agg_State.h:47
std::string toPointer
Definition: Agg_State.h:45
aggState(const Input &in, queryState &qs)
Definition: Agg_State.h:26
void success(const Input &in, queryState &qs)
Definition: Agg_State.h:31
std::unique_ptr< joda::query::IValueProvider > groupedByValue
Definition: Agg_State.h:49
aggFunction aggfun
Definition: Agg_State.h:46
Definition: Query_State.h:21
std::shared_ptr< joda::query::Query > q
Definition: Query_State.h:33