A platform for high-performance distributed tool and library development written in C++. It can be deployed in two different cluster modes: standalone or distributed. API for v0.5.0, released on June 13, 2018.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
AbstractAggregateComp.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * *
3  * Copyright 2018 Rice University *
4  * *
5  * Licensed under the Apache License, Version 2.0 (the "License"); *
6  * you may not use this file except in compliance with the License. *
7  * You may obtain a copy of the License at *
8  * *
9  * http://www.apache.org/licenses/LICENSE-2.0 *
10  * *
11  * Unless required by applicable law or agreed to in writing, software *
12  * distributed under the License is distributed on an "AS IS" BASIS, *
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14  * See the License for the specific language governing permissions and *
15  * limitations under the License. *
16  * *
17  *****************************************************************************/
18 #ifndef ABSTRACT_AGG_COMP
19 #define ABSTRACT_AGG_COMP
20 
21 #include "Computation.h"
22 #include "DataTypes.h"
24 #include "DataProxy.h"
26 #include "ScanUserSet.h"
27 #include "DataTypes.h"
28 #include <vector>
29 
30 
31 namespace pdb {
32 
38 
39 public:
40 
44  AbstractAggregateComp() = default;
45 
52  virtual SimpleSingleTableQueryProcessorPtr getCombinerProcessor(std::vector<HashPartitionID> nodePartitionIds) = 0;
53 
61 
68 
74  this->numPartitions = numPartitions;
75  }
76 
83  return this->numPartitions;
84  }
85 
90  void setNumNodes(int numNodes) {
91  this->numNodes = numNodes;
92  }
93 
99  int getNumNodes() {
100  return this->numNodes;
101  }
102 
107  void setBatchSize(int batchSize) override {
108  this->batchSize = batchSize;
109  }
110 
115  int getBatchSize() {
116  return this->batchSize;
117  }
118 
123  virtual void setIterator(PageCircularBufferIteratorPtr iterator) = 0;
124 
129  virtual void setProxy(DataProxyPtr proxy) = 0;
130 
135  virtual void setDatabaseName(std::string dbName) = 0;
136 
141  virtual void setSetName(std::string setName) = 0;
142 
149  }
150 
155  bool needsMaterializeOutput() override {
156  return this->materializeAggOut;
157  }
158 
163  void setHashTable(void* hashTableLocation) {
164  this->materializeAggOut = false;
165  this->whereHashTableSitsForThePartition = hashTableLocation;
166  }
167 
172  bool isUsingCombiner() override {
173  return useCombinerOrNot;
174  }
175 
180  void setUsingCombiner(bool useCombinerOrNot) override {
181  this->useCombinerOrNot = useCombinerOrNot;
182  }
183 
184 
185 protected:
189  int numPartitions = -1;
190 
194  int numNodes = -1;
195 
199  int batchSize = -1;
200 
205 
209  bool materializeAggOut = false;
210 
214  bool useCombinerOrNot = true;
215 };
216 }
217 
218 #endif
ComputationTypeID
Definition: Computation.h:39
void setBatchSize(int batchSize) override
shared_ptr< DataProxy > DataProxyPtr
Definition: DataProxy.h:30
void setUsingCombiner(bool useCombinerOrNot) override
unsigned int HashPartitionID
Definition: DataTypes.h:28
virtual void setProxy(DataProxyPtr proxy)=0
void setHashTable(void *hashTableLocation)
ComputationTypeID getComputationTypeID() override
virtual SimpleSingleTableQueryProcessorPtr getAggOutProcessor()=0
std::shared_ptr< SimpleSingleTableQueryProcessor > SimpleSingleTableQueryProcessorPtr
virtual SimpleSingleTableQueryProcessorPtr getCombinerProcessor(std::vector< HashPartitionID > nodePartitionIds)=0
void setNumPartitions(int numPartitions)
virtual void setSetName(std::string setName)=0
virtual void setIterator(PageCircularBufferIteratorPtr iterator)=0
virtual void setDatabaseName(std::string dbName)=0
virtual SimpleSingleTableQueryProcessorPtr getAggregationProcessor(HashPartitionID id)=0
shared_ptr< PageCircularBufferIterator > PageCircularBufferIteratorPtr