OmniSciDB  ca0c39ec8f
 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 std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
 
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::TranslationMap
< Datum > * 
addStringProxyNumericTranslationMap (const StringDictionaryProxy *source_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)
 
const
StringDictionaryProxy::TranslationMap
< Datum > * 
getOrAddStringProxyNumericTranslationMap (const int source_dict_id_in, const bool with_generation, 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::map< std::string,
StringDictionaryProxy::TranslationMap
< Datum > > 
str_proxy_numeric_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 369 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 271 of file RowSetMemoryOwner.h.

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

271  {
272  for (auto count_distinct_set : count_distinct_sets_) {
273  delete count_distinct_set;
274  }
275  for (auto group_by_buffer : group_by_buffers_) {
276  free(group_by_buffer);
277  }
278  for (auto varlen_buffer : varlen_buffers_) {
279  free(varlen_buffer);
280  }
281  for (auto varlen_input_buffer : varlen_input_buffers_) {
282  CHECK(varlen_input_buffer);
283  varlen_input_buffer->unPin();
284  }
285  for (auto col_buffer : col_buffers_) {
286  free(col_buffer);
287  }
288  }
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 266 of file RowSetMemoryOwner.h.

References col_buffers_, and state_mutex_.

266  {
267  std::lock_guard<std::mutex> lock(state_mutex_);
268  col_buffers_.push_back(const_cast<void*>(col_buffer));
269  }
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 240 of file RowSetMemoryOwner.h.

References lit_str_dict_proxy_, and state_mutex_.

241  {
242  std::lock_guard<std::mutex> lock(state_mutex_);
243  lit_str_dict_proxy_ = lit_str_dict_proxy;
244  }
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 161 of file RowSetMemoryOwner.h.

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

164  {
165  std::lock_guard<std::mutex> lock(state_mutex_);
166  const auto map_key =
168  dest_proxy->getDictionary()->getDictId(),
169  string_op_infos);
170  auto it = str_proxy_intersection_translation_maps_owned_.find(map_key);
173  .emplace(map_key,
175  dest_proxy, string_op_infos))
176  .first;
177  }
178  return &it->second;
179  }
StringDictionary * getDictionary() const noexcept
std::map< std::string, StringDictionaryProxy::IdMap > str_proxy_intersection_translation_maps_owned_
std::string generate_translation_map_key(const int32_t source_proxy_id, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
int32_t getDictId() const noexcept
IdMap buildIntersectionTranslationMapToOtherProxy(const StringDictionaryProxy *dest_proxy, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos) const

+ Here is the call graph for this function:

const StringDictionaryProxy::TranslationMap<Datum>* RowSetMemoryOwner::addStringProxyNumericTranslationMap ( const StringDictionaryProxy source_proxy,
const std::vector< StringOps_Namespace::StringOpInfo > &  string_op_infos 
)
inline

Definition at line 181 of file RowSetMemoryOwner.h.

References StringDictionaryProxy::buildNumericTranslationMap(), generate_translation_map_key(), StringDictionary::getDictId(), StringDictionaryProxy::getDictionary(), and str_proxy_numeric_translation_maps_owned_.

183  {
184  const auto map_key = generate_translation_map_key(
185  source_proxy->getDictionary()->getDictId(), string_op_infos);
186  auto it = str_proxy_numeric_translation_maps_owned_.lower_bound(map_key);
187  if (it->first != map_key) {
189  it, map_key, source_proxy->buildNumericTranslationMap(string_op_infos));
190  }
191  return &it->second;
192  }
std::map< std::string, StringDictionaryProxy::TranslationMap< Datum > > str_proxy_numeric_translation_maps_owned_
StringDictionary * getDictionary() const noexcept
TranslationMap< Datum > buildNumericTranslationMap(const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos) const
Builds a vectorized string_id translation map from this proxy to dest_proxy.
std::string generate_translation_map_key(const int32_t source_proxy_id, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
int32_t getDictId() const noexcept

+ 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 194 of file RowSetMemoryOwner.h.

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

197  {
198  std::lock_guard<std::mutex> lock(state_mutex_);
199  const auto map_key =
201  dest_proxy->getDictionary()->getDictId(),
202  string_op_infos);
203  auto it = str_proxy_union_translation_maps_owned_.find(map_key);
204  if (it == str_proxy_union_translation_maps_owned_.end()) {
206  .emplace(map_key,
208  dest_proxy, string_op_infos))
209  .first;
210  }
211  return &it->second;
212  }
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
std::string generate_translation_map_key(const int32_t source_proxy_id, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
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 290 of file RowSetMemoryOwner.h.

References arena_block_size_, lit_str_dict_proxy_, and str_dict_proxy_owned_.

290  {
291  auto rtn = std::make_shared<RowSetMemoryOwner>(arena_block_size_, /*num_kernels=*/1);
292  rtn->str_dict_proxy_owned_ = str_dict_proxy_owned_;
293  rtn->lit_str_dict_proxy_ = lit_str_dict_proxy_;
294  return rtn;
295  }
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 std::vector< StringOps_Namespace::StringOpInfo > &  string_op_infos 
)
inline

Definition at line 142 of file RowSetMemoryOwner.h.

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

144  {
145  std::ostringstream oss;
146  oss << "{source_dict_id: " << source_proxy_id << " StringOps: " << string_op_infos
147  << "}";
148  return oss.str();
149  }

+ Here is the caller graph for this function:

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 151 of file RowSetMemoryOwner.h.

154  {
155  std::ostringstream oss;
156  oss << "{source_dict_id: " << source_proxy_id << ", dest_dict_id: " << dest_proxy_id
157  << " StringOps: " << string_op_infos << "}";
158  return oss.str();
159  }
StringDictionaryProxy* RowSetMemoryOwner::getLiteralStringDictProxy ( ) const
inline

Definition at line 246 of file RowSetMemoryOwner.h.

References lit_str_dict_proxy_, and state_mutex_.

246  {
247  std::lock_guard<std::mutex> lock(state_mutex_);
248  return lit_str_dict_proxy_.get();
249  }
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:311
#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::TranslationMap< Datum > * RowSetMemoryOwner::getOrAddStringProxyNumericTranslationMap ( const int  source_dict_id_in,
const bool  with_generation,
const std::vector< StringOps_Namespace::StringOpInfo > &  string_op_infos,
const Catalog_Namespace::Catalog catalog 
)

Definition at line 636 of file Execute.cpp.

640  {
641  const auto source_proxy =
642  getOrAddStringDictProxy(source_dict_id_in, with_generation, catalog);
643  return addStringProxyNumericTranslationMap(source_proxy, string_op_infos);
644 }
const StringDictionaryProxy::TranslationMap< Datum > * addStringProxyNumericTranslationMap(const StringDictionaryProxy *source_proxy, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
StringDictionaryProxy * getOrAddStringDictProxy(const int dict_id_in, const bool with_generation, const Catalog_Namespace::Catalog *catalog)
Definition: Execute.cpp:542
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 617 of file Execute.cpp.

References SOURCE_INTERSECTION.

623  {
624  const auto source_proxy =
625  getOrAddStringDictProxy(source_dict_id_in, with_generation, catalog);
626  auto dest_proxy = getOrAddStringDictProxy(dest_dict_id_in, with_generation, catalog);
629  source_proxy, dest_proxy, string_op_infos);
630  } else {
631  return addStringProxyUnionTranslationMap(source_proxy, dest_proxy, string_op_infos);
632  }
633 }
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 301 of file RowSetMemoryOwner.h.

References string_dictionary_generations_.

301  {
303  }
StringDictionaryGenerations string_dictionary_generations_
StringDictionaryProxy* RowSetMemoryOwner::getStringDictProxy ( const int  dict_id) const
inline

Definition at line 228 of file RowSetMemoryOwner.h.

References CHECK, state_mutex_, and str_dict_proxy_owned_.

228  {
229  std::lock_guard<std::mutex> lock(state_mutex_);
230  auto it = str_dict_proxy_owned_.find(dict_id);
231  CHECK(it != str_dict_proxy_owned_.end());
232  return it->second.get();
233  }
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 214 of file RowSetMemoryOwner.h.

References generate_translation_map_key(), state_mutex_, and string_ops_owned_.

215  {
216  std::lock_guard<std::mutex> lock(state_mutex_);
217  const auto map_key = generate_translation_map_key(0, 0, string_op_infos);
218  auto it = string_ops_owned_.find(map_key);
219  if (it == string_ops_owned_.end()) {
220  it = string_ops_owned_
221  .emplace(map_key,
222  std::make_shared<StringOps_Namespace::StringOps>(string_op_infos))
223  .first;
224  }
225  return it->second.get();
226  }
std::map< std::string, std::shared_ptr< StringOps_Namespace::StringOps > > string_ops_owned_
std::string generate_translation_map_key(const int32_t source_proxy_id, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)

+ 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 321 of file RowSetMemoryOwner.h.

References table_function_metadata_store_, and table_function_metadata_store_mutex_.

324  {
325  std::lock_guard<std::mutex> lock(table_function_metadata_store_mutex_);
326  auto const itr = table_function_metadata_store_.find(key);
327  if (itr == table_function_metadata_store_.end()) {
328  throw std::runtime_error("Failed to find Table Function Metadata with key '" +
329  std::string(key) + "'");
330  }
331  raw_data = itr->second.first.data();
332  num_bytes = itr->second.first.size();
333  value_type = itr->second.second;
334  }
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 646 of file Execute.cpp.

References g_approx_quantile_buffer, and g_approx_quantile_centroids.

646  {
647  std::lock_guard<std::mutex> lock(state_mutex_);
648  return t_digests_
649  .emplace_back(std::make_unique<quantile::TDigest>(
651  .get();
652 }
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 297 of file RowSetMemoryOwner.h.

References string_dictionary_generations_.

297  {
298  string_dictionary_generations_ = generations;
299  }
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 311 of file RowSetMemoryOwner.h.

References table_function_metadata_store_, and table_function_metadata_store_mutex_.

314  {
315  MetadataValue metadata_value(num_bytes, value_type);
316  std::memcpy(metadata_value.first.data(), raw_data, num_bytes);
317  std::lock_guard<std::mutex> lock(table_function_metadata_store_mutex_);
318  table_function_metadata_store_[key] = std::move(metadata_value);
319  }
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 374 of file RowSetMemoryOwner.h.

friend class ResultSet
friend

Definition at line 373 of file RowSetMemoryOwner.h.

Member Data Documentation

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

Definition at line 365 of file RowSetMemoryOwner.h.

Referenced by allocate(), and RowSetMemoryOwner().

size_t RowSetMemoryOwner::arena_block_size_
private

Definition at line 364 of file RowSetMemoryOwner.h.

Referenced by cloneStrDictDataOnly().

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

Definition at line 348 of file RowSetMemoryOwner.h.

Referenced by addArray().

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

Definition at line 358 of file RowSetMemoryOwner.h.

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

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

Definition at line 343 of file RowSetMemoryOwner.h.

Referenced by addCountDistinctBuffer().

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

Definition at line 344 of file RowSetMemoryOwner.h.

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

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

Definition at line 345 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 349 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 351 of file RowSetMemoryOwner.h.

Referenced by addStringProxyIntersectionTranslationMap().

std::map<std::string, StringDictionaryProxy::TranslationMap<Datum> > RowSetMemoryOwner::str_proxy_numeric_translation_maps_owned_
private

Definition at line 355 of file RowSetMemoryOwner.h.

Referenced by addStringProxyNumericTranslationMap().

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

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

Referenced by getStringOps().

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

Definition at line 347 of file RowSetMemoryOwner.h.

Referenced by addString().

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

Definition at line 360 of file RowSetMemoryOwner.h.

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

Definition at line 370 of file RowSetMemoryOwner.h.

Referenced by getTableFunctionMetadata(), and setTableFunctionMetadata().

std::mutex RowSetMemoryOwner::table_function_metadata_store_mutex_
mutableprivate

Definition at line 371 of file RowSetMemoryOwner.h.

Referenced by getTableFunctionMetadata(), and setTableFunctionMetadata().

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

Definition at line 346 of file RowSetMemoryOwner.h.

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

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

Definition at line 359 of file RowSetMemoryOwner.h.

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


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