OmniSciDB  e465130ba1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RowSetMemoryOwner Class Reference

#include <RowSetMemoryOwner.h>

+ Inheritance diagram for RowSetMemoryOwner:
+ Collaboration diagram for RowSetMemoryOwner:

Classes

struct  CountDistinctBitmapBuffer
 

Public Member Functions

void addCountDistinctBuffer (int8_t *count_distinct_buffer, const size_t bytes, const bool system_allocated)
 
void addCountDistinctSet (std::set< int64_t > *count_distinct_set)
 
void addGroupByBuffer (int64_t *group_by_buffer)
 
void addVarlenBuffer (void *varlen_buffer)
 
void addVarlenInputBuffer (Data_Namespace::AbstractBuffer *buffer)
 
std::string * addString (const std::string &str)
 
std::vector< int64_t > * addArray (const std::vector< int64_t > &arr)
 
StringDictionaryProxyaddStringDict (std::shared_ptr< StringDictionary > str_dict, const int dict_id, const ssize_t generation)
 
StringDictionaryProxygetStringDictProxy (const int dict_id) const
 
void addLiteralStringDictProxy (std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy)
 
StringDictionaryProxygetLiteralStringDictProxy () const
 
void addColBuffer (const void *col_buffer)
 
 ~RowSetMemoryOwner ()
 
std::shared_ptr
< RowSetMemoryOwner
cloneStrDictDataOnly ()
 

Private Attributes

std::vector
< CountDistinctBitmapBuffer
count_distinct_bitmaps_
 
std::vector< std::set< int64_t > * > count_distinct_sets_
 
std::vector< int64_t * > group_by_buffers_
 
std::vector< void * > varlen_buffers_
 
std::list< std::string > strings_
 
std::list< std::vector< int64_t > > arrays_
 
std::unordered_map< int,
std::shared_ptr
< StringDictionaryProxy > > 
str_dict_proxy_owned_
 
std::shared_ptr
< StringDictionaryProxy
lit_str_dict_proxy_
 
std::vector< void * > col_buffers_
 
std::vector
< Data_Namespace::AbstractBuffer * > 
varlen_input_buffers_
 
std::mutex state_mutex_
 

Friends

class ResultSet
 

Detailed Description

Definition at line 33 of file RowSetMemoryOwner.h.

Constructor & Destructor Documentation

RowSetMemoryOwner::~RowSetMemoryOwner ( )
inline

Definition at line 121 of file RowSetMemoryOwner.h.

References CHECK(), col_buffers_, count_distinct_bitmaps_, count_distinct_sets_, group_by_buffers_, varlen_buffers_, and varlen_input_buffers_.

121  {
122  for (const auto& count_distinct_buffer : count_distinct_bitmaps_) {
123  if (count_distinct_buffer.system_allocated) {
124  free(count_distinct_buffer.ptr);
125  }
126  }
127  for (auto count_distinct_set : count_distinct_sets_) {
128  delete count_distinct_set;
129  }
130  for (auto group_by_buffer : group_by_buffers_) {
131  free(group_by_buffer);
132  }
133  for (auto varlen_buffer : varlen_buffers_) {
134  free(varlen_buffer);
135  }
136  for (auto varlen_input_buffer : varlen_input_buffers_) {
137  CHECK(varlen_input_buffer);
138  varlen_input_buffer->unPin();
139  }
140  for (auto col_buffer : col_buffers_) {
141  free(col_buffer);
142  }
143  }
std::vector< std::set< int64_t > * > count_distinct_sets_
std::vector< CountDistinctBitmapBuffer > count_distinct_bitmaps_
std::vector< void * > col_buffers_
CHECK(cgen_state)
std::vector< void * > varlen_buffers_
std::vector< Data_Namespace::AbstractBuffer * > varlen_input_buffers_
std::vector< int64_t * > group_by_buffers_

+ Here is the call graph for this function:

Member Function Documentation

std::vector<int64_t>* RowSetMemoryOwner::addArray ( const std::vector< int64_t > &  arr)
inline

Definition at line 75 of file RowSetMemoryOwner.h.

References arrays_, and state_mutex_.

75  {
76  std::lock_guard<std::mutex> lock(state_mutex_);
77  arrays_.emplace_back(arr);
78  return &arrays_.back();
79  }
std::list< std::vector< int64_t > > arrays_
void RowSetMemoryOwner::addColBuffer ( const void *  col_buffer)
inline

Definition at line 116 of file RowSetMemoryOwner.h.

References col_buffers_, and state_mutex_.

Referenced by JoinHashTable::getAllColumnFragments(), and BaselineJoinHashTable::getAllColumnFragments().

116  {
117  std::lock_guard<std::mutex> lock(state_mutex_);
118  col_buffers_.push_back(const_cast<void*>(col_buffer));
119  }
std::vector< void * > col_buffers_

+ Here is the caller graph for this function:

void RowSetMemoryOwner::addCountDistinctBuffer ( int8_t *  count_distinct_buffer,
const size_t  bytes,
const bool  system_allocated 
)
inline

Definition at line 35 of file RowSetMemoryOwner.h.

References count_distinct_bitmaps_, and state_mutex_.

37  {
38  std::lock_guard<std::mutex> lock(state_mutex_);
39  count_distinct_bitmaps_.emplace_back(
40  CountDistinctBitmapBuffer{count_distinct_buffer, bytes, system_allocated});
41  }
std::vector< CountDistinctBitmapBuffer > count_distinct_bitmaps_
void RowSetMemoryOwner::addCountDistinctSet ( std::set< int64_t > *  count_distinct_set)
inline

Definition at line 43 of file RowSetMemoryOwner.h.

References count_distinct_sets_, and state_mutex_.

43  {
44  std::lock_guard<std::mutex> lock(state_mutex_);
45  count_distinct_sets_.push_back(count_distinct_set);
46  }
std::vector< std::set< int64_t > * > count_distinct_sets_
void RowSetMemoryOwner::addGroupByBuffer ( int64_t *  group_by_buffer)
inline

Definition at line 48 of file RowSetMemoryOwner.h.

References group_by_buffers_, and state_mutex_.

48  {
49  std::lock_guard<std::mutex> lock(state_mutex_);
50  group_by_buffers_.push_back(group_by_buffer);
51  }
std::vector< int64_t * > group_by_buffers_
void RowSetMemoryOwner::addLiteralStringDictProxy ( std::shared_ptr< StringDictionaryProxy lit_str_dict_proxy)
inline

Definition at line 105 of file RowSetMemoryOwner.h.

References lit_str_dict_proxy_, and state_mutex_.

106  {
107  std::lock_guard<std::mutex> lock(state_mutex_);
108  lit_str_dict_proxy_ = lit_str_dict_proxy;
109  }
std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy_
std::string* RowSetMemoryOwner::addString ( const std::string &  str)
inline

Definition at line 69 of file RowSetMemoryOwner.h.

References state_mutex_, and strings_.

69  {
70  std::lock_guard<std::mutex> lock(state_mutex_);
71  strings_.emplace_back(str);
72  return &strings_.back();
73  }
std::list< std::string > strings_
StringDictionaryProxy* RowSetMemoryOwner::addStringDict ( std::shared_ptr< StringDictionary str_dict,
const int  dict_id,
const ssize_t  generation 
)
inline

Definition at line 81 of file RowSetMemoryOwner.h.

References CHECK_EQ, state_mutex_, and str_dict_proxy_owned_.

83  {
84  std::lock_guard<std::mutex> lock(state_mutex_);
85  auto it = str_dict_proxy_owned_.find(dict_id);
86  if (it != str_dict_proxy_owned_.end()) {
87  CHECK_EQ(it->second->getDictionary(), str_dict.get());
88  it->second->updateGeneration(generation);
89  return it->second.get();
90  }
92  .emplace(dict_id,
93  std::make_shared<StringDictionaryProxy>(str_dict, generation))
94  .first;
95  return it->second.get();
96  }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
std::unordered_map< int, std::shared_ptr< StringDictionaryProxy > > str_dict_proxy_owned_
void RowSetMemoryOwner::addVarlenBuffer ( void *  varlen_buffer)
inline

Definition at line 53 of file RowSetMemoryOwner.h.

References state_mutex_, and varlen_buffers_.

53  {
54  std::lock_guard<std::mutex> lock(state_mutex_);
55  varlen_buffers_.push_back(varlen_buffer);
56  }
std::vector< void * > varlen_buffers_
void RowSetMemoryOwner::addVarlenInputBuffer ( Data_Namespace::AbstractBuffer buffer)
inline

Adds a GPU buffer containing a variable length input column. Variable length inputs on GPU are referenced in output projected targets and should not be freed until the query results have been resolved.

Definition at line 63 of file RowSetMemoryOwner.h.

References CHECK_EQ, Data_Namespace::AbstractBuffer::getType(), Data_Namespace::GPU_LEVEL, state_mutex_, and varlen_input_buffers_.

63  {
64  std::lock_guard<std::mutex> lock(state_mutex_);
66  varlen_input_buffers_.push_back(buffer);
67  }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
virtual MemoryLevel getType() const =0
std::vector< Data_Namespace::AbstractBuffer * > varlen_input_buffers_

+ Here is the call graph for this function:

std::shared_ptr<RowSetMemoryOwner> RowSetMemoryOwner::cloneStrDictDataOnly ( )
inline

Definition at line 145 of file RowSetMemoryOwner.h.

References lit_str_dict_proxy_, and str_dict_proxy_owned_.

145  {
146  auto rtn = std::make_shared<RowSetMemoryOwner>();
147  rtn->str_dict_proxy_owned_ = str_dict_proxy_owned_;
148  rtn->lit_str_dict_proxy_ = lit_str_dict_proxy_;
149  return rtn;
150  }
std::unordered_map< int, std::shared_ptr< StringDictionaryProxy > > str_dict_proxy_owned_
std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy_
StringDictionaryProxy* RowSetMemoryOwner::getLiteralStringDictProxy ( ) const
inline

Definition at line 111 of file RowSetMemoryOwner.h.

References lit_str_dict_proxy_, and state_mutex_.

111  {
112  std::lock_guard<std::mutex> lock(state_mutex_);
113  return lit_str_dict_proxy_.get();
114  }
std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy_
StringDictionaryProxy* RowSetMemoryOwner::getStringDictProxy ( const int  dict_id) const
inline

Definition at line 98 of file RowSetMemoryOwner.h.

References CHECK(), state_mutex_, and str_dict_proxy_owned_.

98  {
99  std::lock_guard<std::mutex> lock(state_mutex_);
100  auto it = str_dict_proxy_owned_.find(dict_id);
101  CHECK(it != str_dict_proxy_owned_.end());
102  return it->second.get();
103  }
std::unordered_map< int, std::shared_ptr< StringDictionaryProxy > > str_dict_proxy_owned_
CHECK(cgen_state)

+ Here is the call graph for this function:

Friends And Related Function Documentation

friend class ResultSet
friend

Definition at line 171 of file RowSetMemoryOwner.h.

Member Data Documentation

std::list<std::vector<int64_t> > RowSetMemoryOwner::arrays_
private

Definition at line 164 of file RowSetMemoryOwner.h.

Referenced by addArray().

std::vector<void*> RowSetMemoryOwner::col_buffers_
private

Definition at line 167 of file RowSetMemoryOwner.h.

Referenced by addColBuffer(), and ~RowSetMemoryOwner().

std::vector<CountDistinctBitmapBuffer> RowSetMemoryOwner::count_distinct_bitmaps_
private

Definition at line 159 of file RowSetMemoryOwner.h.

Referenced by addCountDistinctBuffer(), and ~RowSetMemoryOwner().

std::vector<std::set<int64_t>*> RowSetMemoryOwner::count_distinct_sets_
private

Definition at line 160 of file RowSetMemoryOwner.h.

Referenced by addCountDistinctSet(), and ~RowSetMemoryOwner().

std::vector<int64_t*> RowSetMemoryOwner::group_by_buffers_
private

Definition at line 161 of file RowSetMemoryOwner.h.

Referenced by addGroupByBuffer(), and ~RowSetMemoryOwner().

std::shared_ptr<StringDictionaryProxy> RowSetMemoryOwner::lit_str_dict_proxy_
private
std::unordered_map<int, std::shared_ptr<StringDictionaryProxy> > RowSetMemoryOwner::str_dict_proxy_owned_
private

Definition at line 165 of file RowSetMemoryOwner.h.

Referenced by addStringDict(), cloneStrDictDataOnly(), and getStringDictProxy().

std::list<std::string> RowSetMemoryOwner::strings_
private

Definition at line 163 of file RowSetMemoryOwner.h.

Referenced by addString().

std::vector<void*> RowSetMemoryOwner::varlen_buffers_
private

Definition at line 162 of file RowSetMemoryOwner.h.

Referenced by addVarlenBuffer(), and ~RowSetMemoryOwner().

std::vector<Data_Namespace::AbstractBuffer*> RowSetMemoryOwner::varlen_input_buffers_
private

Definition at line 168 of file RowSetMemoryOwner.h.

Referenced by addVarlenInputBuffer(), and ~RowSetMemoryOwner().


The documentation for this class was generated from the following file: