Class HashtableRecycler

class HashtableRecycler : public DataRecycler<std::shared_ptr<HashTable>, HashtableCacheMetaInfo>

Public Functions

HashtableRecycler(CacheItemType hashtable_type, int num_gpus)
void putItemToCache(QueryPlanHash key, std::shared_ptr<HashTable> item_ptr, CacheItemType item_type, DeviceIdentifier device_identifier, size_t item_size, size_t compute_time, std::optional<HashtableCacheMetaInfo> meta_info = std::nullopt)
void initCache()
void clearCache()
void markCachedItemAsDirty(size_t table_key, std::unordered_set<QueryPlanHash> &key_set, CacheItemType item_type, DeviceIdentifier device_identifier)
std::string toString() const
bool checkOverlapsHashtableBucketCompatability(const OverlapsHashTableMetaInfo &candidate_bucket_dim, const OverlapsHashTableMetaInfo &target_bucket_dim) const
std::tuple<QueryPlanHash, std::shared_ptr<HashTable>, std::optional<HashtableCacheMetaInfo>> getCachedHashtableWithoutCacheKey(std::set<size_t> &visited, CacheItemType hash_table_type, DeviceIdentifier device_identifier)
void addQueryPlanDagForTableKeys(size_t hashed_query_plan_dag, const std::unordered_set<size_t> &table_keys)
std::optional<std::unordered_set<size_t>> getMappedQueryPlanDagsWithTableKey(size_t table_key) const
void removeTableKeyInfoFromQueryPlanDagMap(size_t table_key)

Public Members

HashtableRecycler::g_hashtable_cache_total_bytes
HashtableRecycler::g_max_cacheable_hashtable_size_bytes
HashtableRecycler::num_gpus{} std::shared_ptr<HashTable> getItemFromCache(QueryPlanHash key,CacheItemType item_type,DeviceIdentifier device_identifier, std::optional<HashtableCacheMetaInfo> meta_info = std::nullopt) override

Public Static Functions

HashtableAccessPathInfo getHashtableAccessPathInfo(const std::vector<InnerOuter> &inner_outer_pairs, const SQLOps op_type, const JoinType join_type, const HashTableBuildDagMap &hashtable_build_dag_map, Executor *executor)
size_t getJoinColumnInfoHash(std::vector<const Analyzer::ColumnVar *> &inner_cols, std::vector<const Analyzer::ColumnVar *> &outer_cols, Executor *executor)
bool isSafeToCacheHashtable(const TableIdToNodeMap &table_id_to_node_map, bool need_dict_translation, const int table_id)

Private Functions

bool hasItemInCache(QueryPlanHash key, CacheItemType item_type, DeviceIdentifier device_identifier, std::lock_guard<std::mutex> &lock, std::optional<HashtableCacheMetaInfo> meta_info = std::nullopt) const
void removeItemFromCache(QueryPlanHash key, CacheItemType item_type, DeviceIdentifier device_identifier, std::lock_guard<std::mutex> &lock, std::optional<HashtableCacheMetaInfo> meta_info = std::nullopt)
void cleanupCacheForInsertion(CacheItemType item_type, DeviceIdentifier device_identifier, size_t required_size, std::lock_guard<std::mutex> &lock, std::optional<HashtableCacheMetaInfo> meta_info = std::nullopt)

Private Members

std::unordered_map<size_t, std::unordered_set<size_t>> table_key_to_query_plan_dag_map_