OmniSciDB  a987f07e93
 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
 
AggModeallocateMode ()
 

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_
 
std::list< AggModemode_maps_
 
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 49 of file RowSetMemoryOwner.h.

Member Typedef Documentation

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

Definition at line 376 of file RowSetMemoryOwner.h.

Member Enumeration Documentation

Enumerator
SOURCE_INTERSECTION 
SOURCE_UNION 

Definition at line 59 of file RowSetMemoryOwner.h.

59 { 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 51 of file RowSetMemoryOwner.h.

References allocators_, and CHECK.

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

Definition at line 272 of file RowSetMemoryOwner.h.

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

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

References arrays_, and state_mutex_.

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

Definition at line 267 of file RowSetMemoryOwner.h.

References col_buffers_, and state_mutex_.

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

References count_distinct_bitmaps_, and state_mutex_.

Referenced by allocateCountDistinctBuffer().

78  {
79  std::lock_guard<std::mutex> lock(state_mutex_);
80  count_distinct_bitmaps_.emplace_back(
81  CountDistinctBitmapBuffer{count_distinct_buffer, bytes, physical_buffer});
82  }
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 84 of file RowSetMemoryOwner.h.

References count_distinct_sets_, and state_mutex_.

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

Definition at line 89 of file RowSetMemoryOwner.h.

References group_by_buffers_, and state_mutex_.

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

Definition at line 241 of file RowSetMemoryOwner.h.

References lit_str_dict_proxy_, and state_mutex_.

242  {
243  std::lock_guard<std::mutex> lock(state_mutex_);
244  lit_str_dict_proxy_ = lit_str_dict_proxy;
245  }
std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy_
std::string* RowSetMemoryOwner::addString ( const std::string &  str)
inline

Definition at line 113 of file RowSetMemoryOwner.h.

References state_mutex_, and strings_.

113  {
114  std::lock_guard<std::mutex> lock(state_mutex_);
115  strings_.emplace_back(str);
116  return &strings_.back();
117  }
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 125 of file RowSetMemoryOwner.h.

References CHECK_EQ, state_mutex_, and str_dict_proxy_owned_.

127  {
128  std::lock_guard<std::mutex> lock(state_mutex_);
129  auto it = str_dict_proxy_owned_.find(dict_id);
130  if (it != str_dict_proxy_owned_.end()) {
131  CHECK_EQ(it->second->getDictionary(), str_dict.get());
132  it->second->updateGeneration(generation);
133  return it->second.get();
134  }
136  .emplace(
137  dict_id,
138  std::make_shared<StringDictionaryProxy>(str_dict, dict_id, generation))
139  .first;
140  return it->second.get();
141  }
#define CHECK_EQ(x, y)
Definition: Logger.h:297
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 162 of file RowSetMemoryOwner.h.

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

165  {
166  std::lock_guard<std::mutex> lock(state_mutex_);
167  const auto map_key =
169  dest_proxy->getDictionary()->getDictId(),
170  string_op_infos);
171  auto it = str_proxy_intersection_translation_maps_owned_.find(map_key);
174  .emplace(map_key,
176  dest_proxy, string_op_infos))
177  .first;
178  }
179  return &it->second;
180  }
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 182 of file RowSetMemoryOwner.h.

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

184  {
185  const auto map_key = generate_translation_map_key(
186  source_proxy->getDictionary()->getDictId(), string_op_infos);
187  auto it = str_proxy_numeric_translation_maps_owned_.lower_bound(map_key);
188  if (it->first != map_key) {
190  it, map_key, source_proxy->buildNumericTranslationMap(string_op_infos));
191  }
192  return &it->second;
193  }
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 195 of file RowSetMemoryOwner.h.

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

198  {
199  std::lock_guard<std::mutex> lock(state_mutex_);
200  const auto map_key =
202  dest_proxy->getDictionary()->getDictId(),
203  string_op_infos);
204  auto it = str_proxy_union_translation_maps_owned_.find(map_key);
205  if (it == str_proxy_union_translation_maps_owned_.end()) {
207  .emplace(map_key,
209  dest_proxy, string_op_infos))
210  .first;
211  }
212  return &it->second;
213  }
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 94 of file RowSetMemoryOwner.h.

References state_mutex_, and varlen_buffers_.

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

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

107  {
108  std::lock_guard<std::mutex> lock(state_mutex_);
110  varlen_input_buffers_.push_back(buffer);
111  }
#define CHECK_EQ(x, y)
Definition: Logger.h:297
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 61 of file RowSetMemoryOwner.h.

References allocators_, CHECK_LT, and state_mutex_.

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

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

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

References addCountDistinctBuffer(), and allocate().

69  {
70  int8_t* buffer = allocate(num_bytes, thread_idx);
71  std::memset(buffer, 0, num_bytes);
72  addCountDistinctBuffer(buffer, num_bytes, /*physical_buffer=*/true);
73  return buffer;
74  }
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:

AggMode* RowSetMemoryOwner::allocateMode ( )
inline

Definition at line 337 of file RowSetMemoryOwner.h.

References mode_maps_, and state_mutex_.

337  {
338  std::lock_guard<std::mutex> lock(state_mutex_);
339  return &mode_maps_.emplace_back();
340  }
std::list< AggMode > mode_maps_
std::shared_ptr<RowSetMemoryOwner> RowSetMemoryOwner::cloneStrDictDataOnly ( )
inline

Definition at line 291 of file RowSetMemoryOwner.h.

References arena_block_size_, lit_str_dict_proxy_, and str_dict_proxy_owned_.

291  {
292  auto rtn = std::make_shared<RowSetMemoryOwner>(arena_block_size_, /*num_kernels=*/1);
293  rtn->str_dict_proxy_owned_ = str_dict_proxy_owned_;
294  rtn->lit_str_dict_proxy_ = lit_str_dict_proxy_;
295  return rtn;
296  }
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 143 of file RowSetMemoryOwner.h.

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

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

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

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

Definition at line 247 of file RowSetMemoryOwner.h.

References lit_str_dict_proxy_, and state_mutex_.

247  {
248  std::lock_guard<std::mutex> lock(state_mutex_);
249  return lit_str_dict_proxy_.get();
250  }
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 540 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.

543  {
544  const int dict_id{dict_id_in < 0 ? REGULAR_DICT(dict_id_in) : dict_id_in};
545  CHECK(catalog);
546  const auto dd = catalog->getMetadataForDict(dict_id);
547  if (dd) {
548  CHECK(dd->stringDict);
549  CHECK_LE(dd->dictNBits, 32);
550  const int64_t generation =
551  with_generation ? string_dictionary_generations_.getGeneration(dict_id) : -1;
552  return addStringDict(dd->stringDict, dict_id, generation);
553  }
555  if (!lit_str_dict_proxy_) {
556  DictRef literal_dict_ref(catalog->getDatabaseId(), DictRef::literalsDictId);
557  std::shared_ptr<StringDictionary> tsd = std::make_shared<StringDictionary>(
558  literal_dict_ref, "", false, true, g_cache_string_hash);
560  std::make_shared<StringDictionaryProxy>(tsd, literal_dict_ref.dictId, 0);
561  }
562  return lit_str_dict_proxy_.get();
563 }
#define CHECK_EQ(x, y)
Definition: Logger.h:297
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:304
const DictDescriptor * getMetadataForDict(int dict_ref, bool loadDict=true) const
Definition: Catalog.cpp:1986
StringDictionaryGenerations string_dictionary_generations_
#define REGULAR_DICT(TRANSIENTID)
Definition: sqltypes.h:312
#define CHECK_LE(x, y)
Definition: Logger.h:300
bool g_cache_string_hash
#define CHECK(condition)
Definition: Logger.h:289
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 634 of file Execute.cpp.

638  {
639  const auto source_proxy =
640  getOrAddStringDictProxy(source_dict_id_in, with_generation, catalog);
641  return addStringProxyNumericTranslationMap(source_proxy, string_op_infos);
642 }
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:540
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 615 of file Execute.cpp.

References SOURCE_INTERSECTION.

621  {
622  const auto source_proxy =
623  getOrAddStringDictProxy(source_dict_id_in, with_generation, catalog);
624  auto dest_proxy = getOrAddStringDictProxy(dest_dict_id_in, with_generation, catalog);
627  source_proxy, dest_proxy, string_op_infos);
628  } else {
629  return addStringProxyUnionTranslationMap(source_proxy, dest_proxy, string_op_infos);
630  }
631 }
StringDictionaryProxy * getOrAddStringDictProxy(const int dict_id_in, const bool with_generation, const Catalog_Namespace::Catalog *catalog)
Definition: Execute.cpp:540
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 302 of file RowSetMemoryOwner.h.

References string_dictionary_generations_.

302  {
304  }
StringDictionaryGenerations string_dictionary_generations_
StringDictionaryProxy* RowSetMemoryOwner::getStringDictProxy ( const int  dict_id) const
inline

Definition at line 229 of file RowSetMemoryOwner.h.

References CHECK, state_mutex_, and str_dict_proxy_owned_.

229  {
230  std::lock_guard<std::mutex> lock(state_mutex_);
231  auto it = str_dict_proxy_owned_.find(dict_id);
232  CHECK(it != str_dict_proxy_owned_.end());
233  return it->second.get();
234  }
std::unordered_map< int, std::shared_ptr< StringDictionaryProxy > > str_dict_proxy_owned_
#define CHECK(condition)
Definition: Logger.h:289
const StringOps_Namespace::StringOps* RowSetMemoryOwner::getStringOps ( const std::vector< StringOps_Namespace::StringOpInfo > &  string_op_infos)
inline

Definition at line 215 of file RowSetMemoryOwner.h.

References generate_translation_map_key(), state_mutex_, and string_ops_owned_.

216  {
217  std::lock_guard<std::mutex> lock(state_mutex_);
218  const auto map_key = generate_translation_map_key(0, 0, string_op_infos);
219  auto it = string_ops_owned_.find(map_key);
220  if (it == string_ops_owned_.end()) {
221  it = string_ops_owned_
222  .emplace(map_key,
223  std::make_shared<StringOps_Namespace::StringOps>(string_op_infos))
224  .first;
225  }
226  return it->second.get();
227  }
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 322 of file RowSetMemoryOwner.h.

References table_function_metadata_store_, and table_function_metadata_store_mutex_.

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

References g_approx_quantile_buffer, and g_approx_quantile_centroids.

644  {
645  std::lock_guard<std::mutex> lock(state_mutex_);
646  return t_digests_
647  .emplace_back(std::make_unique<quantile::TDigest>(
649  .get();
650 }
size_t g_approx_quantile_buffer
Definition: Execute.cpp:159
std::vector< std::unique_ptr< quantile::TDigest > > t_digests_
size_t g_approx_quantile_centroids
Definition: Execute.cpp:160
void RowSetMemoryOwner::setDictionaryGenerations ( StringDictionaryGenerations  generations)
inline

Definition at line 298 of file RowSetMemoryOwner.h.

References string_dictionary_generations_.

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

References table_function_metadata_store_, and table_function_metadata_store_mutex_.

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

friend class ResultSet
friend

Definition at line 380 of file RowSetMemoryOwner.h.

Member Data Documentation

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

Definition at line 372 of file RowSetMemoryOwner.h.

Referenced by allocate(), and RowSetMemoryOwner().

size_t RowSetMemoryOwner::arena_block_size_
private

Definition at line 371 of file RowSetMemoryOwner.h.

Referenced by cloneStrDictDataOnly().

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

Definition at line 354 of file RowSetMemoryOwner.h.

Referenced by addArray().

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

Definition at line 364 of file RowSetMemoryOwner.h.

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

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

Definition at line 349 of file RowSetMemoryOwner.h.

Referenced by addCountDistinctBuffer().

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

Definition at line 350 of file RowSetMemoryOwner.h.

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

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

Definition at line 351 of file RowSetMemoryOwner.h.

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

std::shared_ptr<StringDictionaryProxy> RowSetMemoryOwner::lit_str_dict_proxy_
private
std::list<AggMode> RowSetMemoryOwner::mode_maps_
private

Definition at line 369 of file RowSetMemoryOwner.h.

Referenced by allocateMode().

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

Definition at line 355 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 357 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 361 of file RowSetMemoryOwner.h.

Referenced by addStringProxyNumericTranslationMap().

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

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

Referenced by getStringOps().

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

Definition at line 353 of file RowSetMemoryOwner.h.

Referenced by addString().

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

Definition at line 366 of file RowSetMemoryOwner.h.

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

Definition at line 377 of file RowSetMemoryOwner.h.

Referenced by getTableFunctionMetadata(), and setTableFunctionMetadata().

std::mutex RowSetMemoryOwner::table_function_metadata_store_mutex_
mutableprivate

Definition at line 378 of file RowSetMemoryOwner.h.

Referenced by getTableFunctionMetadata(), and setTableFunctionMetadata().

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

Definition at line 352 of file RowSetMemoryOwner.h.

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

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

Definition at line 365 of file RowSetMemoryOwner.h.

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


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