26 #include <unordered_set> 50 oeq = (std::abs(*overlaps_hashjoin_bucket_threshold -
57 optype == that.
optype && oeq;
63 oeq = (std::abs(*overlaps_hashjoin_bucket_threshold -
70 optype < that.
optype && !oeq &&
77 static void set(
const std::vector<ChunkKey>& key,
const HashType hash_type);
79 static std::pair<HashType, bool>
get(
const std::vector<ChunkKey>& key);
95 static std::shared_ptr<BaselineJoinHashTable> getInstance(
96 const std::shared_ptr<Analyzer::BinOper> condition,
97 const std::vector<InputTableInfo>& query_infos,
100 const int device_count,
104 static size_t getShardCountForCondition(
106 const Executor* executor,
107 const std::vector<InnerOuter>& inner_outer_pairs);
110 const int device_id = 0,
111 bool raw =
false)
const override;
114 const int device_id)
const override;
119 const size_t)
override;
121 int getInnerTableId()
const noexcept
override;
123 int getInnerTableRteIdx()
const noexcept
override;
125 HashType getHashType()
const noexcept
override;
128 return memory_level_;
133 size_t offsetBufferOff()
const noexcept
override;
135 size_t countBufferOff()
const noexcept
override;
137 size_t payloadBufferOff()
const noexcept
override;
142 return []() ->
void {
144 CHECK(hash_table_cache_);
145 hash_table_cache_->clear();
151 CHECK(hash_table_cache_);
152 return hash_table_cache_.get();
159 const std::vector<InputTableInfo>& query_infos,
163 const std::vector<InnerOuter>& inner_outer_pairs,
164 const int device_count);
166 size_t getComponentBufferSize()
const noexcept
override;
168 size_t getKeyBufferSize()
const noexcept;
170 static int getInnerTableId(
const std::vector<InnerOuter>& inner_outer_pairs);
172 virtual void reifyWithLayout(
const HashType layout);
175 const std::vector<Fragmenter_Namespace::FragmentInfo>& fragments,
179 virtual std::pair<size_t, size_t> approximateTupleCount(
180 const std::vector<ColumnsForDevice>&)
const;
182 virtual size_t getKeyComponentWidth()
const;
184 virtual size_t getKeyComponentCount()
const;
188 size_t shardCount()
const;
191 const std::vector<InnerOuter>& inner_outer_pairs)
const;
193 void reify(
const HashType preferred_layout);
198 const size_t entry_count,
199 const size_t emitted_keys_count,
202 virtual int initHashTableForDevice(
203 const std::vector<JoinColumn>& join_columns,
204 const std::vector<JoinColumnTypeInfo>& join_column_types,
205 const std::vector<JoinBucketInfo>& join_buckets,
208 const size_t entry_count,
209 const size_t emitted_keys_count,
210 const int device_id);
212 llvm::Value* hashPtr(
const size_t index);
214 std::shared_ptr<HashTable> initHashTableOnCpuFromCache(
const HashTableCacheKey&);
217 std::shared_ptr<HashTable>& hash_table);
219 std::pair<std::optional<size_t>,
size_t> getApproximateTupleCountFromCache(
222 bool isBitwiseEq()
const;
235 std::optional<HashType>
239 static std::unique_ptr<HashTableCache<HashTableCacheKey, HashTableCacheValue>>
Defines data structures for the semantic analysis phase of query processing.
static std::unique_ptr< HashTableCache< HashTableCacheKey, HashTableCacheValue > > hash_table_cache_
std::string toString(const ExtArgumentType &sig_type)
class for a per-database catalog. also includes metadata for the current database and the current use...
static std::mutex hash_type_cache_mutex_
std::unordered_map< int, std::unordered_map< int, std::shared_ptr< const ColumnarResults > >> ColumnCacheMap
std::shared_ptr< HashTable > HashTableCacheValue
static std::map< std::vector< ChunkKey >, HashType > hash_type_cache_
const size_t num_elements
Data_Namespace::MemoryLevel getMemoryLevel() const noexcept override
const std::vector< InputTableInfo > & query_infos_
static auto * getHashTableCache()
std::vector< InnerOuter > inner_outer_pairs_
virtual ~BaselineJoinHashTable()
ColumnCacheMap & column_cache_
std::string getHashJoinType() const final
bool operator==(const struct HashTableCacheKey &that) const
std::optional< HashType > layout_override_
const boost::optional< double > overlaps_hashjoin_bucket_threshold
bool operator<(const struct HashTableCacheKey &that) const
const Catalog_Namespace::Catalog * catalog_
const Data_Namespace::MemoryLevel memory_level_
int getDeviceCount() const noexcept override
std::mutex cpu_hash_table_buff_mutex_
Executor(const ExecutorId id, const size_t block_size_x, const size_t grid_size_x, const size_t max_gpu_slab_size, const std::string &debug_dir, const std::string &debug_file)
static auto getCacheInvalidator() -> std::function< void()>
const std::shared_ptr< Analyzer::BinOper > condition_
const std::vector< ChunkKey > chunk_keys