38 #include <llvm/IR/Value.h>
53 static std::shared_ptr<PerfectJoinHashTable>
getInstance(
54 const std::shared_ptr<Analyzer::BinOper> qual_bin_oper,
55 const std::vector<InputTableInfo>& query_infos,
59 const int device_count,
67 const int device_id = 0,
68 bool raw =
false)
const override;
71 const int device_id)
const override;
76 const size_t)
override;
83 return col_var_.get()->get_rte_idx();
122 auto candidate_table_keys =
124 if (candidate_table_keys.has_value()) {
127 *candidate_table_keys,
131 *candidate_table_keys,
150 const std::vector<ColumnsForDevice>& columns_per_device)
const;
153 const std::vector<Fragmenter_Namespace::FragmentInfo>& fragments,
168 const int device_id);
171 const std::vector<InnerOuter>& inner_outer_pairs)
const;
177 const std::vector<InputTableInfo>& query_infos,
186 const int device_count,
190 const size_t rowid_size,
226 std::shared_ptr<PerfectHashTable> hashtable_ptr,
228 size_t hashtable_building_time);
237 llvm::Value* key_lvs,
239 const int shard_count,
251 Data_Namespace::
DataMgr* data_mgr);
274 boost::hash_combine(hash, info.
optype);
275 boost::hash_combine(hash, info.
join_type);
312 const Executor* executor);
316 const bool needs_dict_translation) {
317 if (needs_dict_translation) {
324 const std::vector<Fragmenter_Namespace::FragmentInfo>& fragments,
326 const int device_count);
330 const std::vector<InputTableInfo>& query_infos);
333 const size_t shard_count,
334 const size_t device_count,
Defines data structures for the semantic analysis phase of query processing.
llvm::Value * codegenHashTableLoad(const size_t table_idx)
BucketizedHashEntryInfo hash_entry_info_
std::string toString() const
std::vector< int > ChunkKey
Data_Namespace::MemoryLevel getEffectiveMemoryLevel(const std::vector< InnerOuter > &inner_outer_pairs) const
ExpressionRange rhs_source_col_range_
std::pair< const Analyzer::ColumnVar *, const Analyzer::Expr * > InnerOuter
size_t getNormalizedHashEntryCount() const
const Data_Namespace::MemoryLevel memory_level_
size_t getComponentBufferSize() const noexceptoverride
std::shared_ptr< Analyzer::BinOper > qual_bin_oper_
PerfectJoinHashTable(const std::shared_ptr< Analyzer::BinOper > qual_bin_oper, const Analyzer::ColumnVar *col_var, const std::vector< InputTableInfo > &query_infos, const Data_Namespace::MemoryLevel memory_level, const JoinType join_type, const HashType preferred_hash_type, const ExpressionRange &col_range, const ExpressionRange &rhs_source_col_range, const BucketizedHashEntryInfo hash_entry_info, ColumnCacheMap &column_cache, Executor *executor, const int device_count, const RegisteredQueryHint &query_hints, const HashTableBuildDagMap &hashtable_build_dag_map, const TableIdToNodeMap &table_id_to_node_map, const size_t rowid_size, const InnerOuterStringOpInfos &inner_outer_string_op_infos={})
std::mutex str_proxy_translation_mutex_
ChunkKey genChunkKey(const std::vector< Fragmenter_Namespace::FragmentInfo > &fragments, const Analyzer::Expr *outer_col, const Analyzer::ColumnVar *inner_col) const
const TableIdToNodeMap table_id_to_node_map_
size_t offsetBufferOff() const noexceptoverride
const Analyzer::ColumnVar * outer_col
std::vector< std::shared_ptr< HashTable > > hash_tables_for_device_
HashTableBuildDagMap hashtable_build_dag_map_
Data_Namespace::MemoryLevel get_effective_memory_level(const Data_Namespace::MemoryLevel memory_level, const bool needs_dict_translation)
const InputTableInfo & get_inner_query_info(const shared::TableKey &inner_table_key, const std::vector< InputTableInfo > &query_infos)
int getDeviceCount() const noexceptoverride
const InputTableInfo & getInnerQueryInfo(const Analyzer::ColumnVar *inner_col) const
size_t payloadBufferOff() const noexceptoverride
ColumnsForDevice fetchColumnsForDevice(const std::vector< Fragmenter_Namespace::FragmentInfo > &fragments, const int device_id, DeviceAllocator *dev_buff_owner)
std::shared_ptr< Analyzer::Expr > deep_copy() const override
static void invalidateCache()
std::shared_ptr< PerfectHashTable > initHashTableOnCpuFromCache(QueryPlanHash key, CacheItemType item_type, DeviceIdentifier device_identifier)
bool needs_dictionary_translation(const std::vector< InnerOuter > &inner_outer_pairs, const std::vector< InnerOuterStringOpInfos > &inner_outer_string_op_infos_pairs, const Executor *executor)
HashType getHashType() const noexceptoverride
HashtableCacheMetaInfo hashtable_cache_meta_info_
static std::unique_ptr< HashtableRecycler > hash_table_cache_
std::string getHashJoinType() const final
shared::TableKey getInnerTableId() const noexceptoverride
std::unordered_map< size_t, HashTableBuildDag > HashTableBuildDagMap
const size_t num_elements
void reifyForDevice(const ChunkKey &hash_table_key, const ColumnsForDevice &columns_for_device, const HashType layout, const int device_id, const logger::ThreadLocalIds)
static HashtableRecycler * getHashTableCache()
std::string toString() const override
std::vector< Fragmenter_Namespace::FragmentInfo > only_shards_for_device(const std::vector< Fragmenter_Namespace::FragmentInfo > &fragments, const int device_id, const int device_count)
bool isOneToOneHashPossible(const std::vector< ColumnsForDevice > &columns_per_device) const
static HashingSchemeRecycler * getHashingSchemeCache()
virtual ~PerfectJoinHashTable()
size_t shardCount() const
const RegisteredQueryHint & getRegisteredQueryHint()
bool needs_dict_translation_
const SQLTypeInfo & get_type_info() const
std::vector< llvm::Value * > getHashJoinArgs(llvm::Value *hash_ptr, llvm::Value *key_lvs, const Analyzer::Expr *key_col, const int shard_count, const CompilationOptions &co)
std::vector< InnerOuter > inner_outer_pairs_
static std::unique_ptr< HashingSchemeRecycler > hash_table_layout_cache_
std::unordered_map< shared::TableKey, const RelAlgNode * > TableIdToNodeMap
static QueryPlanHash getAlternativeCacheKey(AlternativeCacheKeyForPerfectHashJoin &info)
const std::vector< InputTableInfo > & query_infos_
ExpressionRange col_range_
void putHashTableOnCpuToCache(QueryPlanHash key, CacheItemType item_type, std::shared_ptr< PerfectHashTable > hashtable_ptr, DeviceIdentifier device_identifier, size_t hashtable_building_time)
std::string toString(const ExecutorDeviceType device_type, const int device_id=0, bool raw=false) const override
size_t getNormalizedHashEntryCount() const
ColumnCacheMap & column_cache_
size_t get_entries_per_device(const size_t total_entries, const size_t shard_count, const size_t device_count, const Data_Namespace::MemoryLevel memory_level)
std::shared_ptr< Analyzer::ColumnVar > col_var_
RegisteredQueryHint query_hints_
BucketizedHashEntryInfo getHashEntryInfo() const
std::unordered_map< shared::TableKey, std::unordered_map< int, std::shared_ptr< const ColumnarResults >>> ColumnCacheMap
static std::shared_ptr< PerfectJoinHashTable > getInstance(const std::shared_ptr< Analyzer::BinOper > qual_bin_oper, const std::vector< InputTableInfo > &query_infos, const Data_Namespace::MemoryLevel memory_level, const JoinType join_type, const HashType preferred_hash_type, const int device_count, ColumnCacheMap &column_cache, Executor *executor, const HashTableBuildDagMap &hashtable_build_dag_map, const RegisteredQueryHint &query_hints, const TableIdToNodeMap &table_id_to_node_map)
Make hash table from an in-flight SQL query's parse tree etc.
const InnerOuterStringOpInfos inner_outer_string_op_infos_
llvm::Value * codegenSlot(const CompilationOptions &, const size_t) override
std::size_t hash_value(RexAbstractInput const &rex_ab_input)
ExpressionRangeType getType() const
std::pair< std::vector< StringOps_Namespace::StringOpInfo >, std::vector< StringOps_Namespace::StringOpInfo >> InnerOuterStringOpInfos
std::mutex cpu_hash_table_buff_mutex_
const Analyzer::ColumnVar * inner_col
size_t countBufferOff() const noexceptoverride
const ExpressionRange col_range
int initHashTableForDevice(const ChunkKey &chunk_key, const JoinColumn &join_column, const InnerOuter &cols, const HashType layout, const Data_Namespace::MemoryLevel effective_memory_level, const int device_id)
void copyCpuHashTableToGpu(std::shared_ptr< PerfectHashTable > &cpu_hash_table, const PerfectHashTableEntryInfo hash_table_entry_info, const int device_id, Data_Namespace::DataMgr *data_mgr)
std::vector< QueryPlanHash > hashtable_cache_key_
HashTable * getHashTableForDevice(const size_t device_id) const
Data_Namespace::MemoryLevel getMemoryLevel() const noexceptoverride
static constexpr DeviceIdentifier CPU_DEVICE_IDENTIFIER
const JoinType join_type_
std::set< DecodedJoinHashBufferEntry > toSet(const ExecutorDeviceType device_type, const int device_id) const override
static void markCachedItemAsDirty(size_t table_key)
const StringDictionaryProxy::IdMap * str_proxy_translation_map_
std::unordered_set< size_t > table_keys_
HashJoinMatchingSet codegenMatchingSet(const CompilationOptions &, const size_t) override
InnerOuterStringOpInfos inner_outer_string_op_infos
bool isBitwiseEq() const override
int getInnerTableRteIdx() const noexceptoverride