OmniSciDB  c0231cc57d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RowSetMemoryOwner Class Referencefinal

#include <RowSetMemoryOwner.h>

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

Classes

struct  CountDistinctBitmapBuffer
 

Public Types

enum  StringTranslationType { StringTranslationType::SOURCE_INTERSECTION, StringTranslationType::SOURCE_UNION }
 

Public Member Functions

 RowSetMemoryOwner (const size_t arena_block_size, const size_t num_kernel_threads=0)
 
int8_t * allocate (const size_t num_bytes, const size_t thread_idx=0) override
 
int8_t * allocateCountDistinctBuffer (const size_t num_bytes, const size_t thread_idx=0)
 
void addCountDistinctBuffer (int8_t *count_distinct_buffer, const size_t bytes, const bool physical_buffer)
 
void addCountDistinctSet (CountDistinctSet *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 int64_t generation)
 
std::string generate_translation_map_key (const int32_t source_proxy_id, const int32_t dest_proxy_id, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
 
const
StringDictionaryProxy::IdMap
addStringProxyIntersectionTranslationMap (const StringDictionaryProxy *source_proxy, const StringDictionaryProxy *dest_proxy, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
 
const
StringDictionaryProxy::IdMap
addStringProxyUnionTranslationMap (const StringDictionaryProxy *source_proxy, StringDictionaryProxy *dest_proxy, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
 
const
StringOps_Namespace::StringOps * 
getStringOps (const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
 
StringDictionaryProxygetStringDictProxy (const int dict_id) const
 
StringDictionaryProxygetOrAddStringDictProxy (const int dict_id_in, const bool with_generation, const Catalog_Namespace::Catalog *catalog)
 
void addLiteralStringDictProxy (std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy)
 
StringDictionaryProxygetLiteralStringDictProxy () const
 
const
StringDictionaryProxy::IdMap
getOrAddStringProxyTranslationMap (const int source_dict_id_in, const int dest_dict_id_in, const bool with_generation, const StringTranslationType translation_map_type, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos, const Catalog_Namespace::Catalog *catalog)
 
void addColBuffer (const void *col_buffer)
 
 ~RowSetMemoryOwner ()
 
std::shared_ptr
< RowSetMemoryOwner
cloneStrDictDataOnly ()
 
void setDictionaryGenerations (StringDictionaryGenerations generations)
 
StringDictionaryGenerationsgetStringDictionaryGenerations ()
 
quantile::TDigestnullTDigest (double const q)
 
void setTableFunctionMetadata (const char *key, const uint8_t *raw_data, const size_t num_bytes, const TableFunctionMetadataType value_type)
 
void getTableFunctionMetadata (const char *key, const uint8_t *&raw_data, size_t &num_bytes, TableFunctionMetadataType &value_type) const
 

Private Types

using MetadataValue = std::pair< std::vector< uint8_t >, TableFunctionMetadataType >
 

Private Attributes

std::vector
< CountDistinctBitmapBuffer
count_distinct_bitmaps_
 
std::vector< CountDistinctSet * > 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::map< std::string,
StringDictionaryProxy::IdMap
str_proxy_intersection_translation_maps_owned_
 
std::map< std::string,
StringDictionaryProxy::IdMap
str_proxy_union_translation_maps_owned_
 
std::shared_ptr
< StringDictionaryProxy
lit_str_dict_proxy_
 
StringDictionaryGenerations string_dictionary_generations_
 
std::vector< void * > col_buffers_
 
std::vector
< Data_Namespace::AbstractBuffer * > 
varlen_input_buffers_
 
std::vector< std::unique_ptr
< quantile::TDigest > > 
t_digests_
 
std::map< std::string,
std::shared_ptr
< StringOps_Namespace::StringOps > > 
string_ops_owned_
 
size_t arena_block_size_
 
std::vector< std::unique_ptr
< Arena > > 
allocators_
 
std::mutex state_mutex_
 
std::map< std::string,
MetadataValue
table_function_metadata_store_
 
std::mutex table_function_metadata_store_mutex_
 

Friends

class ResultSet
 
class QueryExecutionContext
 

Additional Inherited Members

- Protected Member Functions inherited from SimpleAllocator
 ~SimpleAllocator ()=default
 

Detailed Description

Handles allocations and outputs for all stages in a query, either explicitly or via a managed allocator object

Definition at line 48 of file RowSetMemoryOwner.h.

Member Typedef Documentation

using RowSetMemoryOwner::MetadataValue = std::pair<std::vector<uint8_t>, TableFunctionMetadataType>
private

Definition at line 342 of file RowSetMemoryOwner.h.

Member Enumeration Documentation

Enumerator
SOURCE_INTERSECTION 
SOURCE_UNION 

Definition at line 58 of file RowSetMemoryOwner.h.

58 { SOURCE_INTERSECTION, SOURCE_UNION };

Constructor & Destructor Documentation

RowSetMemoryOwner::RowSetMemoryOwner ( const size_t  arena_block_size,
const size_t  num_kernel_threads = 0 
)
inline

Definition at line 50 of file RowSetMemoryOwner.h.

References allocators_, and CHECK.

51  : arena_block_size_(arena_block_size) {
52  for (size_t i = 0; i < num_kernel_threads + 1; i++) {
53  allocators_.emplace_back(std::make_unique<DramArena>(arena_block_size));
54  }
55  CHECK(!allocators_.empty());
56  }
std::vector< std::unique_ptr< Arena > > allocators_
#define CHECK(condition)
Definition: Logger.h:222
RowSetMemoryOwner::~RowSetMemoryOwner ( )
inline

Definition at line 246 of file RowSetMemoryOwner.h.

References CHECK, col_buffers_, count_distinct_sets_, group_by_buffers_, varlen_buffers_, and varlen_input_buffers_.

246  {
247  for (auto count_distinct_set : count_distinct_sets_) {
248  delete count_distinct_set;
249  }
250  for (auto group_by_buffer : group_by_buffers_) {
251  free(group_by_buffer);
252  }
253  for (auto varlen_buffer : varlen_buffers_) {
254  free(varlen_buffer);
255  }
256  for (auto varlen_input_buffer : varlen_input_buffers_) {
257  CHECK(varlen_input_buffer);
258  varlen_input_buffer->unPin();
259  }
260  for (auto col_buffer : col_buffers_) {
261  free(col_buffer);
262  }
263  }
std::vector< CountDistinctSet * > count_distinct_sets_
std::vector< void * > col_buffers_
std::vector< void * > varlen_buffers_
std::vector< Data_Namespace::AbstractBuffer * > varlen_input_buffers_
#define CHECK(condition)
Definition: Logger.h:222
std::vector< int64_t * > group_by_buffers_

Member Function Documentation

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

Definition at line 118 of file RowSetMemoryOwner.h.

References arrays_, and state_mutex_.

118  {
119  std::lock_guard<std::mutex> lock(state_mutex_);
120  arrays_.emplace_back(arr);
121  return &arrays_.back();
122  }
std::list< std::vector< int64_t > > arrays_
void RowSetMemoryOwner::addColBuffer ( const void *  col_buffer)
inline

Definition at line 241 of file RowSetMemoryOwner.h.

References col_buffers_, and state_mutex_.

241  {
242  std::lock_guard<std::mutex> lock(state_mutex_);
243  col_buffers_.push_back(const_cast<void*>(col_buffer));
244  }
std::vector< void * > col_buffers_
void RowSetMemoryOwner::addCountDistinctBuffer ( int8_t *  count_distinct_buffer,
const size_t  bytes,
const bool  physical_buffer 
)
inline

Definition at line 75 of file RowSetMemoryOwner.h.

References count_distinct_bitmaps_, and state_mutex_.

Referenced by allocateCountDistinctBuffer().

77  {
78  std::lock_guard<std::mutex> lock(state_mutex_);
79  count_distinct_bitmaps_.emplace_back(
80  CountDistinctBitmapBuffer{count_distinct_buffer, bytes, physical_buffer});
81  }
std::vector< CountDistinctBitmapBuffer > count_distinct_bitmaps_

+ Here is the caller graph for this function:

void RowSetMemoryOwner::addCountDistinctSet ( CountDistinctSet count_distinct_set)
inline

Definition at line 83 of file RowSetMemoryOwner.h.

References count_distinct_sets_, and state_mutex_.

83  {
84  std::lock_guard<std::mutex> lock(state_mutex_);
85  count_distinct_sets_.push_back(count_distinct_set);
86  }
std::vector< CountDistinctSet * > count_distinct_sets_
void RowSetMemoryOwner::addGroupByBuffer ( int64_t *  group_by_buffer)
inline

Definition at line 88 of file RowSetMemoryOwner.h.

References group_by_buffers_, and state_mutex_.

88  {
89  std::lock_guard<std::mutex> lock(state_mutex_);
90  group_by_buffers_.push_back(group_by_buffer);
91  }
std::vector< int64_t * > group_by_buffers_
void RowSetMemoryOwner::addLiteralStringDictProxy ( std::shared_ptr< StringDictionaryProxy lit_str_dict_proxy)
inline

Definition at line 222 of file RowSetMemoryOwner.h.

References lit_str_dict_proxy_, and state_mutex_.

223  {
224  std::lock_guard<std::mutex> lock(state_mutex_);
225  lit_str_dict_proxy_ = lit_str_dict_proxy;
226  }
std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy_
std::string* RowSetMemoryOwner::addString ( const std::string &  str)
inline

Definition at line 112 of file RowSetMemoryOwner.h.

References state_mutex_, and strings_.

112  {
113  std::lock_guard<std::mutex> lock(state_mutex_);
114  strings_.emplace_back(str);
115  return &strings_.back();
116  }
std::list< std::string > strings_
StringDictionaryProxy* RowSetMemoryOwner::addStringDict ( std::shared_ptr< StringDictionary str_dict,
const int  dict_id,
const int64_t  generation 
)
inline

Definition at line 124 of file RowSetMemoryOwner.h.

References CHECK_EQ, state_mutex_, and str_dict_proxy_owned_.

126  {
127  std::lock_guard<std::mutex> lock(state_mutex_);
128  auto it = str_dict_proxy_owned_.find(dict_id);
129  if (it != str_dict_proxy_owned_.end()) {
130  CHECK_EQ(it->second->getDictionary(), str_dict.get());
131  it->second->updateGeneration(generation);
132  return it->second.get();
133  }
135  .emplace(
136  dict_id,
137  std::make_shared<StringDictionaryProxy>(str_dict, dict_id, generation))
138  .first;
139  return it->second.get();
140  }
#define CHECK_EQ(x, y)
Definition: Logger.h:230
std::unordered_map< int, std::shared_ptr< StringDictionaryProxy > > str_dict_proxy_owned_
const StringDictionaryProxy::IdMap* RowSetMemoryOwner::addStringProxyIntersectionTranslationMap ( const StringDictionaryProxy source_proxy,
const StringDictionaryProxy dest_proxy,
const std::vector< StringOps_Namespace::StringOpInfo > &  string_op_infos 
)
inline

Definition at line 156 of file RowSetMemoryOwner.h.

References StringDictionaryProxy::buildIntersectionTranslationMapToOtherProxy(), generate_translation_map_key(), StringDictionary::getDictId(), StringDictionaryProxy::getDictionary(), state_mutex_, and str_proxy_intersection_translation_maps_owned_.

159  {
160  std::lock_guard<std::mutex> lock(state_mutex_);
161  const auto map_key =
163  dest_proxy->getDictionary()->getDictId(),
164  string_op_infos);
165  auto it = str_proxy_intersection_translation_maps_owned_.find(map_key);
168  .emplace(map_key,
170  dest_proxy, string_op_infos))
171  .first;
172  }
173  return &it->second;
174  }
std::string generate_translation_map_key(const int32_t source_proxy_id, const int32_t dest_proxy_id, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
StringDictionary * getDictionary() const noexcept
std::map< std::string, StringDictionaryProxy::IdMap > str_proxy_intersection_translation_maps_owned_
int32_t getDictId() const noexcept
IdMap buildIntersectionTranslationMapToOtherProxy(const StringDictionaryProxy *dest_proxy, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos) const
Builds a vectorized string_id translation map from this proxy to dest_proxy.

+ Here is the call graph for this function:

const StringDictionaryProxy::IdMap* RowSetMemoryOwner::addStringProxyUnionTranslationMap ( const StringDictionaryProxy source_proxy,
StringDictionaryProxy dest_proxy,
const std::vector< StringOps_Namespace::StringOpInfo > &  string_op_infos 
)
inline

Definition at line 176 of file RowSetMemoryOwner.h.

References StringDictionaryProxy::buildUnionTranslationMapToOtherProxy(), generate_translation_map_key(), StringDictionary::getDictId(), StringDictionaryProxy::getDictionary(), state_mutex_, and str_proxy_union_translation_maps_owned_.

179  {
180  std::lock_guard<std::mutex> lock(state_mutex_);
181  const auto map_key =
183  dest_proxy->getDictionary()->getDictId(),
184  string_op_infos);
185  auto it = str_proxy_union_translation_maps_owned_.find(map_key);
186  if (it == str_proxy_union_translation_maps_owned_.end()) {
188  .emplace(map_key,
190  dest_proxy, string_op_infos))
191  .first;
192  }
193  return &it->second;
194  }
std::string generate_translation_map_key(const int32_t source_proxy_id, const int32_t dest_proxy_id, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
StringDictionary * getDictionary() const noexcept
std::map< std::string, StringDictionaryProxy::IdMap > str_proxy_union_translation_maps_owned_
IdMap buildUnionTranslationMapToOtherProxy(StringDictionaryProxy *dest_proxy, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_types) const
int32_t getDictId() const noexcept

+ Here is the call graph for this function:

void RowSetMemoryOwner::addVarlenBuffer ( void *  varlen_buffer)
inline

Definition at line 93 of file RowSetMemoryOwner.h.

References state_mutex_, and varlen_buffers_.

93  {
94  std::lock_guard<std::mutex> lock(state_mutex_);
95  if (std::find(varlen_buffers_.begin(), varlen_buffers_.end(), varlen_buffer) ==
96  varlen_buffers_.end()) {
97  varlen_buffers_.push_back(varlen_buffer);
98  }
99  }
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 106 of file RowSetMemoryOwner.h.

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

106  {
107  std::lock_guard<std::mutex> lock(state_mutex_);
109  varlen_input_buffers_.push_back(buffer);
110  }
#define CHECK_EQ(x, y)
Definition: Logger.h:230
virtual MemoryLevel getType() const =0
std::vector< Data_Namespace::AbstractBuffer * > varlen_input_buffers_

+ Here is the call graph for this function:

int8_t* RowSetMemoryOwner::allocate ( const size_t  num_bytes,
const size_t  thread_idx = 0 
)
inlineoverridevirtual

Implements SimpleAllocator.

Definition at line 60 of file RowSetMemoryOwner.h.

References allocators_, CHECK_LT, and state_mutex_.

Referenced by anonymous_namespace{QueryMemoryInitializer.cpp}::alloc_group_by_buffer(), and allocateCountDistinctBuffer().

60  {
61  CHECK_LT(thread_idx, allocators_.size());
62  auto allocator = allocators_[thread_idx].get();
63  std::lock_guard<std::mutex> lock(state_mutex_);
64  return reinterpret_cast<int8_t*>(allocator->allocate(num_bytes));
65  }
std::vector< std::unique_ptr< Arena > > allocators_
#define CHECK_LT(x, y)
Definition: Logger.h:232

+ Here is the caller graph for this function:

int8_t* RowSetMemoryOwner::allocateCountDistinctBuffer ( const size_t  num_bytes,
const size_t  thread_idx = 0 
)
inline

Definition at line 67 of file RowSetMemoryOwner.h.

References addCountDistinctBuffer(), and allocate().

68  {
69  int8_t* buffer = allocate(num_bytes, thread_idx);
70  std::memset(buffer, 0, num_bytes);
71  addCountDistinctBuffer(buffer, num_bytes, /*physical_buffer=*/true);
72  return buffer;
73  }
void addCountDistinctBuffer(int8_t *count_distinct_buffer, const size_t bytes, const bool physical_buffer)
int8_t * allocate(const size_t num_bytes, const size_t thread_idx=0) override

+ Here is the call graph for this function:

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

Definition at line 265 of file RowSetMemoryOwner.h.

References arena_block_size_, lit_str_dict_proxy_, and str_dict_proxy_owned_.

265  {
266  auto rtn = std::make_shared<RowSetMemoryOwner>(arena_block_size_, /*num_kernels=*/1);
267  rtn->str_dict_proxy_owned_ = str_dict_proxy_owned_;
268  rtn->lit_str_dict_proxy_ = lit_str_dict_proxy_;
269  return rtn;
270  }
std::unordered_map< int, std::shared_ptr< StringDictionaryProxy > > str_dict_proxy_owned_
std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy_
std::string RowSetMemoryOwner::generate_translation_map_key ( const int32_t  source_proxy_id,
const int32_t  dest_proxy_id,
const std::vector< StringOps_Namespace::StringOpInfo > &  string_op_infos 
)
inline

Definition at line 142 of file RowSetMemoryOwner.h.

Referenced by addStringProxyIntersectionTranslationMap(), addStringProxyUnionTranslationMap(), and getStringOps().

145  {
146  std::ostringstream oss;
147  oss << "{source_dict_id: " << source_proxy_id << ", dest_dict_id: " << dest_proxy_id
148  << " StringOps: " << string_op_infos << "}";
149  // for (const auto& string_op_info : string_op_infos) {
150  // oss << "{" << string_op_info.toString() << "}";
151  //}
152  // oss << "]";
153  return oss.str();
154  }

+ Here is the caller graph for this function:

StringDictionaryProxy* RowSetMemoryOwner::getLiteralStringDictProxy ( ) const
inline

Definition at line 228 of file RowSetMemoryOwner.h.

References lit_str_dict_proxy_, and state_mutex_.

228  {
229  std::lock_guard<std::mutex> lock(state_mutex_);
230  return lit_str_dict_proxy_.get();
231  }
std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy_
StringDictionaryProxy * RowSetMemoryOwner::getOrAddStringDictProxy ( const int  dict_id_in,
const bool  with_generation,
const Catalog_Namespace::Catalog catalog 
)

Definition at line 542 of file Execute.cpp.

References CHECK, CHECK_EQ, CHECK_LE, g_cache_string_hash, Catalog_Namespace::Catalog::getDatabaseId(), Catalog_Namespace::Catalog::getMetadataForDict(), dict_ref_t::literalsDictId, and REGULAR_DICT.

545  {
546  const int dict_id{dict_id_in < 0 ? REGULAR_DICT(dict_id_in) : dict_id_in};
547  CHECK(catalog);
548  const auto dd = catalog->getMetadataForDict(dict_id);
549  if (dd) {
550  CHECK(dd->stringDict);
551  CHECK_LE(dd->dictNBits, 32);
552  const int64_t generation =
553  with_generation ? string_dictionary_generations_.getGeneration(dict_id) : -1;
554  return addStringDict(dd->stringDict, dict_id, generation);
555  }
557  if (!lit_str_dict_proxy_) {
558  DictRef literal_dict_ref(catalog->getDatabaseId(), DictRef::literalsDictId);
559  std::shared_ptr<StringDictionary> tsd = std::make_shared<StringDictionary>(
560  literal_dict_ref, "", false, true, g_cache_string_hash);
562  std::make_shared<StringDictionaryProxy>(tsd, literal_dict_ref.dictId, 0);
563  }
564  return lit_str_dict_proxy_.get();
565 }
#define CHECK_EQ(x, y)
Definition: Logger.h:230
int64_t getGeneration(const uint32_t id) const
StringDictionaryProxy * addStringDict(std::shared_ptr< StringDictionary > str_dict, const int dict_id, const int64_t generation)
std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy_
int getDatabaseId() const
Definition: Catalog.h:298
const DictDescriptor * getMetadataForDict(int dict_ref, bool loadDict=true) const
Definition: Catalog.cpp:1960
StringDictionaryGenerations string_dictionary_generations_
#define REGULAR_DICT(TRANSIENTID)
Definition: sqltypes.h:336
#define CHECK_LE(x, y)
Definition: Logger.h:233
bool g_cache_string_hash
#define CHECK(condition)
Definition: Logger.h:222
static constexpr int32_t literalsDictId
Definition: DictRef.h:15

+ Here is the call graph for this function:

const StringDictionaryProxy::IdMap * RowSetMemoryOwner::getOrAddStringProxyTranslationMap ( const int  source_dict_id_in,
const int  dest_dict_id_in,
const bool  with_generation,
const StringTranslationType  translation_map_type,
const std::vector< StringOps_Namespace::StringOpInfo > &  string_op_infos,
const Catalog_Namespace::Catalog catalog 
)

Definition at line 604 of file Execute.cpp.

References SOURCE_INTERSECTION.

610  {
611  const auto source_proxy =
612  getOrAddStringDictProxy(source_dict_id_in, with_generation, catalog);
613  auto dest_proxy = getOrAddStringDictProxy(dest_dict_id_in, with_generation, catalog);
616  source_proxy, dest_proxy, string_op_infos);
617  } else {
618  return addStringProxyUnionTranslationMap(source_proxy, dest_proxy, string_op_infos);
619  }
620 }
StringDictionaryProxy * getOrAddStringDictProxy(const int dict_id_in, const bool with_generation, const Catalog_Namespace::Catalog *catalog)
Definition: Execute.cpp:542
const StringDictionaryProxy::IdMap * addStringProxyUnionTranslationMap(const StringDictionaryProxy *source_proxy, StringDictionaryProxy *dest_proxy, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
const StringDictionaryProxy::IdMap * addStringProxyIntersectionTranslationMap(const StringDictionaryProxy *source_proxy, const StringDictionaryProxy *dest_proxy, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
StringDictionaryGenerations& RowSetMemoryOwner::getStringDictionaryGenerations ( )
inline

Definition at line 276 of file RowSetMemoryOwner.h.

References string_dictionary_generations_.

276  {
278  }
StringDictionaryGenerations string_dictionary_generations_
StringDictionaryProxy* RowSetMemoryOwner::getStringDictProxy ( const int  dict_id) const
inline

Definition at line 210 of file RowSetMemoryOwner.h.

References CHECK, state_mutex_, and str_dict_proxy_owned_.

210  {
211  std::lock_guard<std::mutex> lock(state_mutex_);
212  auto it = str_dict_proxy_owned_.find(dict_id);
213  CHECK(it != str_dict_proxy_owned_.end());
214  return it->second.get();
215  }
std::unordered_map< int, std::shared_ptr< StringDictionaryProxy > > str_dict_proxy_owned_
#define CHECK(condition)
Definition: Logger.h:222
const StringOps_Namespace::StringOps* RowSetMemoryOwner::getStringOps ( const std::vector< StringOps_Namespace::StringOpInfo > &  string_op_infos)
inline

Definition at line 196 of file RowSetMemoryOwner.h.

References generate_translation_map_key(), state_mutex_, and string_ops_owned_.

197  {
198  std::lock_guard<std::mutex> lock(state_mutex_);
199  const auto map_key = generate_translation_map_key(0, 0, string_op_infos);
200  auto it = string_ops_owned_.find(map_key);
201  if (it == string_ops_owned_.end()) {
202  it = string_ops_owned_
203  .emplace(map_key,
204  std::make_shared<StringOps_Namespace::StringOps>(string_op_infos))
205  .first;
206  }
207  return it->second.get();
208  }
std::string generate_translation_map_key(const int32_t source_proxy_id, const int32_t dest_proxy_id, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
std::map< std::string, std::shared_ptr< StringOps_Namespace::StringOps > > string_ops_owned_

+ Here is the call graph for this function:

void RowSetMemoryOwner::getTableFunctionMetadata ( const char *  key,
const uint8_t *&  raw_data,
size_t &  num_bytes,
TableFunctionMetadataType value_type 
) const
inline

Definition at line 296 of file RowSetMemoryOwner.h.

References table_function_metadata_store_, and table_function_metadata_store_mutex_.

299  {
300  std::lock_guard<std::mutex> lock(table_function_metadata_store_mutex_);
301  auto const itr = table_function_metadata_store_.find(key);
302  if (itr == table_function_metadata_store_.end()) {
303  throw std::runtime_error("Failed to find Table Function Metadata with key '" +
304  std::string(key) + "'");
305  }
306  raw_data = itr->second.first.data();
307  num_bytes = itr->second.first.size();
308  value_type = itr->second.second;
309  }
std::mutex table_function_metadata_store_mutex_
std::map< std::string, MetadataValue > table_function_metadata_store_
quantile::TDigest * RowSetMemoryOwner::nullTDigest ( double const  q)

Definition at line 622 of file Execute.cpp.

References g_approx_quantile_buffer, and g_approx_quantile_centroids.

622  {
623  std::lock_guard<std::mutex> lock(state_mutex_);
624  return t_digests_
625  .emplace_back(std::make_unique<quantile::TDigest>(
627  .get();
628 }
size_t g_approx_quantile_buffer
Definition: Execute.cpp:158
std::vector< std::unique_ptr< quantile::TDigest > > t_digests_
size_t g_approx_quantile_centroids
Definition: Execute.cpp:159
void RowSetMemoryOwner::setDictionaryGenerations ( StringDictionaryGenerations  generations)
inline

Definition at line 272 of file RowSetMemoryOwner.h.

References string_dictionary_generations_.

272  {
273  string_dictionary_generations_ = generations;
274  }
StringDictionaryGenerations string_dictionary_generations_
void RowSetMemoryOwner::setTableFunctionMetadata ( const char *  key,
const uint8_t *  raw_data,
const size_t  num_bytes,
const TableFunctionMetadataType  value_type 
)
inline

Definition at line 286 of file RowSetMemoryOwner.h.

References table_function_metadata_store_, and table_function_metadata_store_mutex_.

289  {
290  MetadataValue metadata_value(num_bytes, value_type);
291  std::memcpy(metadata_value.first.data(), raw_data, num_bytes);
292  std::lock_guard<std::mutex> lock(table_function_metadata_store_mutex_);
293  table_function_metadata_store_[key] = std::move(metadata_value);
294  }
std::pair< std::vector< uint8_t >, TableFunctionMetadataType > MetadataValue
std::mutex table_function_metadata_store_mutex_
std::map< std::string, MetadataValue > table_function_metadata_store_

Friends And Related Function Documentation

friend class QueryExecutionContext
friend

Definition at line 347 of file RowSetMemoryOwner.h.

friend class ResultSet
friend

Definition at line 346 of file RowSetMemoryOwner.h.

Member Data Documentation

std::vector<std::unique_ptr<Arena> > RowSetMemoryOwner::allocators_
private

Definition at line 338 of file RowSetMemoryOwner.h.

Referenced by allocate(), and RowSetMemoryOwner().

size_t RowSetMemoryOwner::arena_block_size_
private

Definition at line 337 of file RowSetMemoryOwner.h.

Referenced by cloneStrDictDataOnly().

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

Definition at line 323 of file RowSetMemoryOwner.h.

Referenced by addArray().

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

Definition at line 331 of file RowSetMemoryOwner.h.

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

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

Definition at line 318 of file RowSetMemoryOwner.h.

Referenced by addCountDistinctBuffer().

std::vector<CountDistinctSet*> RowSetMemoryOwner::count_distinct_sets_
private

Definition at line 319 of file RowSetMemoryOwner.h.

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

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

Definition at line 320 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 324 of file RowSetMemoryOwner.h.

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

std::map<std::string, StringDictionaryProxy::IdMap> RowSetMemoryOwner::str_proxy_intersection_translation_maps_owned_
private

Definition at line 326 of file RowSetMemoryOwner.h.

Referenced by addStringProxyIntersectionTranslationMap().

std::map<std::string, StringDictionaryProxy::IdMap> RowSetMemoryOwner::str_proxy_union_translation_maps_owned_
private

Definition at line 328 of file RowSetMemoryOwner.h.

Referenced by addStringProxyUnionTranslationMap().

StringDictionaryGenerations RowSetMemoryOwner::string_dictionary_generations_
private
std::map<std::string, std::shared_ptr<StringOps_Namespace::StringOps> > RowSetMemoryOwner::string_ops_owned_
private

Definition at line 335 of file RowSetMemoryOwner.h.

Referenced by getStringOps().

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

Definition at line 322 of file RowSetMemoryOwner.h.

Referenced by addString().

std::vector<std::unique_ptr<quantile::TDigest> > RowSetMemoryOwner::t_digests_
private

Definition at line 333 of file RowSetMemoryOwner.h.

std::map<std::string, MetadataValue> RowSetMemoryOwner::table_function_metadata_store_
private

Definition at line 343 of file RowSetMemoryOwner.h.

Referenced by getTableFunctionMetadata(), and setTableFunctionMetadata().

std::mutex RowSetMemoryOwner::table_function_metadata_store_mutex_
mutableprivate

Definition at line 344 of file RowSetMemoryOwner.h.

Referenced by getTableFunctionMetadata(), and setTableFunctionMetadata().

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

Definition at line 321 of file RowSetMemoryOwner.h.

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

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

Definition at line 332 of file RowSetMemoryOwner.h.

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


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