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.
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
JoinMap.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 JOIN_MAP_H
20
#define JOIN_MAP_H
21
22
// PRELOAD %JoinMap <Nothing>%
23
24
#include "
Object.h
"
25
#include "
Handle.h
"
26
#include "
JoinPairArray.h
"
27
28
template
<
typename
StoredType>
29
class
JoinRecordLst
;
30
31
namespace
pdb {
32
33
// This is the Map type used to power joins
34
35
template
<
class
ValueType>
36
class
JoinMap
:
public
Object
{
37
38
private
:
39
// this is where the data are actually stored
40
Handle<JoinPairArray<ValueType>
>
myArray
;
41
42
// size of ValueType
43
size_t
objectSize
;
44
45
// my partition id
46
size_t
partitionId
;
47
48
// number of partitions (per node)
49
int
numPartitions
;
50
51
public
:
52
ENABLE_DEEP_COPY
53
54
// this constructor creates a map with specified slots, partitionId and numPartitions
55
JoinMap
(uint32_t initSize,
size_t
partitionId
,
int
numPartitions
);
56
57
// this constructor pre-allocates initSize slots... initSize must be a power of two
58
JoinMap
(uint32_t initSize);
59
60
// this constructor creates a map with a single slot
61
JoinMap
();
62
63
// destructor
64
~JoinMap
();
65
66
// allows us to access all of the records with a particular hash value
67
JoinRecordList<ValueType>
lookup
(
const
size_t
& which);
68
69
// adds a new value at position which
70
ValueType&
push
(
const
size_t
& which);
71
72
// clears the particular key from the map, destructing both the key and the value.
73
// This is typically used when an out-of-memory
74
// exception is thrown when we try to add to the hash table, and we want to immediately clear
75
// the last item added.
76
void
setUnused
(
const
size_t
& clearMe);
77
78
// returns the number of elements in the map
79
size_t
size
()
const
;
80
81
// returns 0 if this entry is undefined; 1 if it is defined
82
int
count
(
const
size_t
& which);
83
84
// these are used for iteration
85
JoinMapIterator<ValueType>
begin
();
86
JoinMapIterator<ValueType>
end
();
87
88
89
// JiaNote: add partition id to enable hash partitioned join
90
size_t
getPartitionId
();
91
void
setPartitionId
(
size_t
partitionId
);
92
int
getNumPartitions
();
93
void
setNumPartitions
(
int
numPartitions
);
94
95
// JiaNote: add this to enable combination of two JoinMaps
96
size_t
getObjectSize
();
97
void
setObjectSize
();
98
};
99
}
100
101
#include "
JoinMap.cc
"
102
103
#endif
pdb::JoinMap::myArray
Handle< JoinPairArray< ValueType > > myArray
Definition:
JoinMap.h:40
ENABLE_DEEP_COPY
#define ENABLE_DEEP_COPY
Definition:
DeepCopy.h:52
pdb::JoinMap::getObjectSize
size_t getObjectSize()
Definition:
JoinMap.cc:130
pdb::Object
Definition:
Object.h:42
JoinRecordLst
Definition:
JoinMap.h:29
pdb::JoinMap::setUnused
void setUnused(const size_t &clearMe)
Definition:
JoinMap.cc:68
pdb::JoinRecordList
Definition:
JoinPairArray.h:55
Handle.h
pdb::JoinMap::~JoinMap
~JoinMap()
Definition:
JoinMap.cc:65
pdb::JoinMap::size
size_t size() const
Definition:
JoinMap.cc:92
pdb::JoinMap::getNumPartitions
int getNumPartitions()
Definition:
JoinMap.cc:119
pdb::JoinMap::begin
JoinMapIterator< ValueType > begin()
Definition:
JoinMap.cc:97
pdb::JoinMapIterator
Definition:
JoinPairArray.h:80
pdb::JoinMap::numPartitions
int numPartitions
Definition:
JoinMap.h:49
pdb::JoinMap::setPartitionId
void setPartitionId(size_t partitionId)
Definition:
JoinMap.cc:114
JoinMap.cc
pdb::JoinMap::setObjectSize
void setObjectSize()
Definition:
JoinMap.cc:135
JoinPairArray.h
pdb::JoinMap::partitionId
size_t partitionId
Definition:
JoinMap.h:46
pdb::JoinMap::setNumPartitions
void setNumPartitions(int numPartitions)
Definition:
JoinMap.cc:124
Object.h
pdb::JoinMap::objectSize
size_t objectSize
Definition:
JoinMap.h:43
pdb::JoinMap::lookup
JoinRecordList< ValueType > lookup(const size_t &which)
Definition:
JoinMap.cc:82
pdb::JoinMap
Definition:
JoinMap.h:36
pdb::JoinMap::push
ValueType & push(const size_t &which)
Definition:
JoinMap.cc:73
pdb::JoinMap::count
int count(const size_t &which)
Definition:
JoinMap.cc:87
pdb::Handle
Definition:
Allocator.h:399
pdb::JoinMap::end
JoinMapIterator< ValueType > end()
Definition:
JoinMap.cc:103
pdb::JoinMap::JoinMap
JoinMap()
Definition:
JoinMap.cc:57
pdb::JoinMap::getPartitionId
size_t getPartitionId()
Definition:
JoinMap.cc:109
plinycompute
pdb
src
builtInPDBObjects
headers
JoinMap.h
Generated on Mon Jun 18 2018 18:10:35 by
1.8.6