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
AbstractPartitionComp.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 
19 #ifndef ABSTRACT_PARTITION_COMP_H
20 #define ABSTRACT_PARTITION_COMP_H
21 
22 #include "Computation.h"
23 #include "VectorSink.h"
24 #include "ScanUserSet.h"
25 #include "TypeName.h"
26 
27 namespace pdb {
28 template<class KeyClass, class ValueClass>
30 
31  public:
32 
33 
37  virtual std::string getComputationType() override {
38  return "AbstractPartitionComp";
39  }
40 
46  }
47 
52  std::string getIthInputType(int i) override {
53  if (i == 0) {
54  return getTypeName<ValueClass>();
55  } else {
56  return "";
57  }
58  }
59 
63  int getNumInputs() override {
64  return 1;
65  }
66 
70  virtual std::string getOutputType() override {
71  return "";
72  };
73 
83  std::string toTCAPString(std::vector<InputTupleSetSpecifier> &inputTupleSets,
84  int computationLabel,
85  std::string &outputTupleSetName,
86  std::vector<std::string> &outputColumnNames,
87  std::string &addedOutputColumnName) override {
88 
89  if (inputTupleSets.empty()) {
90  return "";
91  }
92  InputTupleSetSpecifier inputTupleSet = inputTupleSets[0];
93  std::vector<std::string> childrenLambdaNames;
94  std::string myLambdaName;
95  return toTCAPString(inputTupleSet.getTupleSetName(),
96  inputTupleSet.getColumnNamesToKeep(),
97  inputTupleSet.getColumnNamesToApply(),
98  childrenLambdaNames,
99  computationLabel,
101  outputColumnNames,
102  addedOutputColumnName,
103  myLambdaName);
104  }
105 
118  virtual std::string toTCAPString(std::string inputTupleSetName,
119  std::vector<std::string> &inputColumnNames,
120  std::vector<std::string> &inputColumnsToApply,
121  std::vector<std::string> &childrenLambdaNames,
122  int computationLabel,
123  std::string &outputTupleSetName,
124  std::vector<std::string> &outputColumnNames,
125  std::string &addedOutputColumnName,
126  std::string &myLambdaName) = 0;
127 
133  virtual void setOutput(std::string dbName, std::string setName) override {}
134 
140  virtual void setBatchSize(int batchSize) override {};
141 
145  virtual std::string getDatabaseName() override {
146  return "";
147  }
148 
152  std::string getSetName() override {
153  return "";
154  }
155 
162  virtual ComputeSourcePtr getComputeSource(TupleSpec &outputScheme, ComputePlan &plan) override {
163  return nullptr;
164  }
165 
174  TupleSpec &projection,
175  ComputePlan &plan) override {
176  return nullptr;
177  }
178 
179 
183  bool needsMaterializeOutput() override {
185  }
186 
187 
192  this->numPartitions = numPartitions;
193  }
194 
199  return this->numPartitions;
200  }
201 
205  void setNumNodes (int numNodes) {
206  this->numNodes = numNodes;
207  }
208 
212  int getNumNodes () {
213  return this->numNodes;
214  }
215 
216 
217  protected:
219  int numPartitions = 16;
220  int numNodes = 2;
221 
222 };
223 
224 }
225 
226 #endif //ABSTRACT_PARTITION_COMP_H
ComputationTypeID
Definition: Computation.h:39
std::shared_ptr< ComputeSource > ComputeSourcePtr
Definition: ComputeSource.h:26
std::vector< std::string > & getColumnNamesToKeep()
virtual ComputeSinkPtr getComputeSink(TupleSpec &consumeMe, TupleSpec &projection, ComputePlan &plan) override
virtual std::string getComputationType() override
virtual std::string getDatabaseName() override
std::string getIthInputType(int i) override
std::string getSetName() override
std::shared_ptr< ComputeSink > ComputeSinkPtr
Definition: ComputeSink.h:27
virtual std::string getOutputType() override
virtual ComputationTypeID getComputationTypeID() override
std::vector< std::string > & getColumnNamesToApply()
void setNumPartitions(int numPartitions)
virtual void setBatchSize(int batchSize) override
virtual void setOutput(std::string dbName, std::string setName) override
std::string toTCAPString(std::vector< InputTupleSetSpecifier > &inputTupleSets, int computationLabel, std::string &outputTupleSetName, std::vector< std::string > &outputColumnNames, std::string &addedOutputColumnName) override
String outputTupleSetName
Definition: Computation.h:379
virtual ComputeSourcePtr getComputeSource(TupleSpec &outputScheme, ComputePlan &plan) override