19 #include <boost/noncopyable.hpp>
24 #include <unordered_map>
37 namespace Catalog_Namespace {
51 for (
size_t i = 0; i < num_kernel_threads + 1; i++) {
52 allocators_.emplace_back(std::make_unique<DramArena>(arena_block_size));
59 int8_t*
allocate(
const size_t num_bytes,
const size_t thread_idx = 0)
override {
63 return reinterpret_cast<int8_t*
>(allocator->allocate(num_bytes));
67 const size_t thread_idx = 0) {
68 int8_t* buffer =
allocate(num_bytes, thread_idx);
69 std::memset(buffer, 0, num_bytes);
76 const bool physical_buffer) {
117 std::vector<int64_t>*
addArray(
const std::vector<int64_t>& arr) {
125 const int64_t generation) {
129 CHECK_EQ(it->second->getDictionary(), str_dict.get());
130 it->second->updateGeneration(generation);
131 return it->second.get();
136 std::make_shared<StringDictionaryProxy>(str_dict, dict_id, generation))
138 return it->second.get();
142 const int32_t source_proxy_id,
143 const int32_t dest_proxy_id,
144 const std::vector<StringOps_Namespace::StringOpInfo>& string_op_infos) {
145 std::ostringstream oss;
146 oss <<
"{source_dict_id: " << source_proxy_id <<
", dest_dict_id: " << dest_proxy_id
147 <<
" StringOps: " << string_op_infos <<
"}";
158 const std::vector<StringOps_Namespace::StringOpInfo>& string_op_infos) {
169 dest_proxy, string_op_infos))
178 const std::vector<StringOps_Namespace::StringOpInfo>& string_op_infos) {
189 dest_proxy, string_op_infos))
196 const std::vector<StringOps_Namespace::StringOpInfo>& string_op_infos) {
203 std::make_shared<StringOps_Namespace::StringOps>(string_op_infos))
206 return it->second.get();
213 return it->second.get();
217 const int dict_id_in,
218 const bool with_generation,
222 std::shared_ptr<StringDictionaryProxy> lit_str_dict_proxy) {
233 const int source_dict_id_in,
234 const int dest_dict_id_in,
235 const bool with_generation,
237 const std::vector<StringOps_Namespace::StringOpInfo>& string_op_infos,
247 delete count_distinct_set;
250 free(group_by_buffer);
256 CHECK(varlen_input_buffer);
257 varlen_input_buffer->unPin();
295 std::map<std::string, StringDictionaryProxy::IdMap>
297 std::map<std::string, StringDictionaryProxy::IdMap>
304 std::map<std::string, std::shared_ptr<StringOps_Namespace::StringOps>>
std::shared_ptr< RowSetMemoryOwner > cloneStrDictDataOnly()
robin_hood::unordered_set< int64_t > CountDistinctSet
std::vector< std::unique_ptr< Arena > > allocators_
int8_t * allocateCountDistinctBuffer(const size_t num_bytes, const size_t thread_idx=0)
std::list< std::vector< int64_t > > arrays_
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)
class for a per-database catalog. also includes metadata for the current database and the current use...
std::unordered_map< int, std::shared_ptr< StringDictionaryProxy > > str_dict_proxy_owned_
void addVarlenInputBuffer(Data_Namespace::AbstractBuffer *buffer)
const bool physical_buffer
void addLiteralStringDictProxy(std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy)
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::list< std::string > strings_
void addCountDistinctBuffer(int8_t *count_distinct_buffer, const size_t bytes, const bool physical_buffer)
virtual MemoryLevel getType() const =0
std::vector< int64_t > * addArray(const std::vector< int64_t > &arr)
int8_t * allocate(const size_t num_bytes, const size_t thread_idx=0) override
ResultSet(const std::vector< TargetInfo > &targets, const ExecutorDeviceType device_type, const QueryMemoryDescriptor &query_mem_desc, const std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const Catalog_Namespace::Catalog *catalog, const unsigned block_size, const unsigned grid_size)
std::vector< CountDistinctSet * > count_distinct_sets_
StringDictionary * getDictionary() const noexcept
quantile::TDigest * nullTDigest(double const q)
StringDictionaryGenerations & getStringDictionaryGenerations()
StringDictionaryProxy * getLiteralStringDictProxy() const
std::map< std::string, StringDictionaryProxy::IdMap > str_proxy_intersection_translation_maps_owned_
void setDictionaryGenerations(StringDictionaryGenerations generations)
std::vector< CountDistinctBitmapBuffer > count_distinct_bitmaps_
std::vector< void * > col_buffers_
StringDictionaryProxy * addStringDict(std::shared_ptr< StringDictionary > str_dict, const int dict_id, const int64_t generation)
std::map< std::string, StringDictionaryProxy::IdMap > str_proxy_union_translation_maps_owned_
std::map< std::string, std::shared_ptr< StringOps_Namespace::StringOps > > string_ops_owned_
std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy_
StringDictionaryProxy * getOrAddStringDictProxy(const int dict_id_in, const bool with_generation, const Catalog_Namespace::Catalog *catalog)
std::vector< void * > varlen_buffers_
std::vector< Data_Namespace::AbstractBuffer * > varlen_input_buffers_
RowSetMemoryOwner(const size_t arena_block_size, const size_t num_kernel_threads=0)
An AbstractBuffer is a unit of data management for a data manager.
StringDictionaryGenerations string_dictionary_generations_
IdMap buildUnionTranslationMapToOtherProxy(StringDictionaryProxy *dest_proxy, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_types) const
const StringOps_Namespace::StringOps * getStringOps(const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
int32_t getDictId() const noexcept
void addVarlenBuffer(void *varlen_buffer)
std::vector< std::unique_ptr< quantile::TDigest > > t_digests_
StringDictionaryProxy * getStringDictProxy(const int dict_id) const
Functions used to work with (approximate) count distinct sets.
void addCountDistinctSet(CountDistinctSet *count_distinct_set)
void addGroupByBuffer(int64_t *group_by_buffer)
const StringDictionaryProxy::IdMap * addStringProxyUnionTranslationMap(const StringDictionaryProxy *source_proxy, StringDictionaryProxy *dest_proxy, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
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.
std::string * addString(const std::string &str)
const StringDictionaryProxy::IdMap * addStringProxyIntersectionTranslationMap(const StringDictionaryProxy *source_proxy, const StringDictionaryProxy *dest_proxy, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos)
void addColBuffer(const void *col_buffer)
std::vector< int64_t * > group_by_buffers_