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
BroadcastJoinBuildHTJobStage.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 BROADCAST_JOIN_BUILDHT_STAGE_H
19 #define BROADCAST_JOIN_BUILDHT_STAGE_H
20 
21 
22 #include "AbstractJobStage.h"
23 #include "SetIdentifier.h"
24 #include "ComputePlan.h"
25 
26 // PRELOAD %BroadcastJoinBuildHTJobStage%
27 
28 namespace pdb {
29 
30 // this class encapsulates the job stage for building hash table for broadcasting join
31 
33 
34 private:
35  // input set
37 
38  // name for output hash table
40 
41  // job stage id
43 
44  // number of pages
45  int numPages;
46 
47  // logical plan information
49 
50  // source tuple set
52 
53  // target tuple set
55 
56  // target computation
58 
59  // memory size on this node
61 
62 public:
64 
65  // constructor
67 
68  // constructor
69  BroadcastJoinBuildHTJobStage(std::string jobId, JobStageID stageId, std::string hashSetName) {
70 
71  this->jobId = jobId;
72  this->id = stageId;
73  this->sharedHashSetName = hashSetName;
74  }
75 
76  // to set source set identifier
78  this->sourceContext = sourceContext;
79  }
80 
81  // to return source set identifier
83  return this->sourceContext;
84  }
85 
86  // return job stage type
87  std::string getJobStageType() override {
88  return "BroadcastJoinBuildHTJobStage";
89  }
90 
91  // return job stage type id
92  int16_t getJobStageTypeID() override {
93  return BroadcastJoinBuildHTJobStage_TYPEID;
94  }
95 
96  // return job stage id
97  JobStageID getStageId() override {
98  return this->id;
99  }
100 
101  // set name of the hash set that stores the broadcasted table
102  void setHashSetName(std::string hashSetName) {
103  this->sharedHashSetName = hashSetName;
104  }
105 
106  // return name of the hash set that stores the broadcasted table
107  std::string getHashSetName() {
108  return this->sharedHashSetName;
109  }
110 
111  void print() override {
112  std::cout << "[JOB ID] jobId = " << jobId << std::endl;
113  std::cout << "[INPUT] databaseName=" << sourceContext->getDatabase()
114  << ", setName=" << sourceContext->getSetName() << std::endl;
115  std::cout << "[STAGE ID] id = " << id << std::endl;
116  std::cout << "[HASH SET] name = " << sharedHashSetName << std::endl;
117  std::cout << "[MEM] total memory=" << totalMemoryOnThisNode << std::endl;
118  std::cout << "[NUM PAGES] numPages=" << numPages << std::endl;
119  std::cout << "[SRCTUPLESET] sourceTupleSetSpecifier=" << sourceTupleSetSpecifier << std::endl;
120  std::cout << "[TARTUPLESET] targetTupleSetSpecifier=" << targetTupleSetSpecifier << std::endl;
121  std::cout << "[TACCOMP] targetComputationSpecifier=" << targetComputationSpecifier << std::endl;
122  }
123 
124  void setNumPages(int numPages) {
125  this->numPages = numPages;
126  }
127 
128  int getNumPages() {
129  return this->numPages;
130  }
131 
132  // to set compute plan
134  const std::string &sourceTupleSetSpecifier,
135  const std::string &targetTupleSetSpecifier,
136  const std::string &targetComputationSpecifier) {
137  this->sharedPlan = plan;
138  this->sourceTupleSetSpecifier = sourceTupleSetSpecifier;
139  this->targetTupleSetSpecifier = targetTupleSetSpecifier;
140  this->targetComputationSpecifier = targetComputationSpecifier;
141  }
142 
143  // nullify compute plan shared pointer
145  this->sharedPlan->nullifyPlanPointer();
146  }
147 
148  // to get source tupleset name for this pipeline stage
150  return this->sourceTupleSetSpecifier;
151  }
152 
153  // to get target tupleset name for this pipeline stage
155  return this->targetTupleSetSpecifier;
156  }
157 
158  // to get target computation name for this pipeline stage
160  return this->targetComputationSpecifier;
161  }
162 
163  // to get compute plan
165  return this->sharedPlan;
166  }
167 
168 
169  void setTotalMemoryOnThisNode(size_t totalMem) {
170  this->totalMemoryOnThisNode = totalMem;
171  }
172 
174  return this->totalMemoryOnThisNode;
175  }
176 };
177 }
178 
179 #endif
#define ENABLE_DEEP_COPY
Definition: DeepCopy.h:52
void setSourceContext(Handle< SetIdentifier > sourceContext)
void setComputePlan(const Handle< ComputePlan > &plan, const std::string &sourceTupleSetSpecifier, const std::string &targetTupleSetSpecifier, const std::string &targetComputationSpecifier)
unsigned int JobStageID
Definition: DataTypes.h:37
void setHashSetName(std::string hashSetName)
BroadcastJoinBuildHTJobStage(std::string jobId, JobStageID stageId, std::string hashSetName)