1#ifndef SQL_ITERATORS_HASH_JOIN_BUFFER_H_
2#define SQL_ITERATORS_HASH_JOIN_BUFFER_H_
64#include "extra/robin-hood-hashing/robin_hood.h"
107using Key = std::string_view;
119 return str1 == other.
Decode();
140 return robin_hood::hash_bytes(
key.data(),
key.size());
144 std::string_view decoded =
key.Decode();
145 return robin_hood::hash_bytes(decoded.data(), decoded.size());
166 std::vector<HashJoinCondition> join_conditions,
167 size_t max_mem_available_bytes);
269 size_t row_size_upper_bound,
bool *full);
The variant with length (ImmutableStringWithLength) stores the length as a Varint128 (similar to prot...
Definition: immutable_string.h:62
std::string_view Decode() const
Definition: immutable_string.h:129
LinkedImmutableString is designed for storing rows (values) in hash join.
Definition: immutable_string.h:172
Definition: sql_executor.h:261
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
Definition: hash_join_buffer.h:161
String m_buffer
Definition: hash_join_buffer.h:239
bool contains(const Key &key) const
Definition: hash_join_buffer.h:213
size_t m_row_size_upper_bound
Definition: hash_join_buffer.h:240
hash_map_type::const_iterator hash_map_iterator
Definition: hash_join_buffer.h:198
hash_map_iterator end() const
Definition: hash_join_buffer.h:204
size_t size() const
Definition: hash_join_buffer.h:189
bool Init()
Definition: hash_join_buffer.cc:142
bool Initialized() const
Definition: hash_join_buffer.h:211
hash_map_iterator begin() const
Definition: hash_join_buffer.h:202
bool empty() const
Definition: hash_join_buffer.h:191
bool inited() const
Definition: hash_join_buffer.h:193
std::unique_ptr< hash_map_type > m_hash_map
Definition: hash_join_buffer.h:235
HashJoinRowBuffer(pack_rows::TableCollection tables, std::vector< HashJoinCondition > join_conditions, size_t max_mem_available_bytes)
Definition: hash_join_buffer.cc:128
LinkedImmutableString m_last_row_stored
Definition: hash_join_buffer.h:251
const std::vector< HashJoinCondition > m_join_conditions
Definition: hash_join_buffer.h:216
const size_t m_max_mem_available
Definition: hash_join_buffer.h:243
LinkedImmutableString StoreLinkedImmutableStringFromTableBuffers(LinkedImmutableString next_ptr, bool *full)
Definition: hash_join_buffer.cc:107
StoreRowResult StoreRow(THD *thd, bool reject_duplicate_keys)
Store the row that is currently lying in the tables record buffers.
Definition: hash_join_buffer.cc:171
const pack_rows::TableCollection m_tables
Definition: hash_join_buffer.h:220
robin_hood::unordered_flat_map< ImmutableStringWithLength, LinkedImmutableString, KeyHasher, KeyEquals > hash_map_type
Definition: hash_join_buffer.h:196
LinkedImmutableString LastRowStored() const
Definition: hash_join_buffer.h:206
hash_map_iterator find(const Key &key) const
Definition: hash_join_buffer.h:200
MEM_ROOT m_overflow_mem_root
Definition: hash_join_buffer.h:232
MEM_ROOT m_mem_root
Definition: hash_join_buffer.h:224
Definition: hash_join_buffer.h:109
void is_transparent
Definition: hash_join_buffer.h:115
bool operator()(const ImmutableStringWithLength &str1, const ImmutableStringWithLength &str2) const
Definition: hash_join_buffer.h:122
bool operator()(const Key &str1, const ImmutableStringWithLength &other) const
Definition: hash_join_buffer.h:117
Definition: hash_join_buffer.h:131
size_t operator()(hash_join_buffer::Key key) const
Definition: hash_join_buffer.h:139
void is_transparent
Definition: hash_join_buffer.h:137
size_t operator()(ImmutableStringWithLength key) const
Definition: hash_join_buffer.h:143
A structure that contains a list of input tables for a hash join operation, BKA join operation or a s...
Definition: pack_rows.h:92
static MEM_ROOT mem_root
Definition: client_plugin.cc:113
This file contains the field type.
LinkedImmutableString StoreLinkedImmutableStringFromTableBuffers(MEM_ROOT *mem_root, MEM_ROOT *overflow_mem_root, pack_rows::TableCollection tables, LinkedImmutableString next_ptr, size_t row_size_upper_bound, bool *full)
External interface to the corresponding member in HashJoinRowBuffer.
Definition: hash_join_buffer.cc:54
ImmutableString defines a storage format for strings that is designed to be as compact as possible,...
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
Some integer typedefs for easier portability.
Definition: hash_join_buffer.cc:104
std::string_view Key
The key type for the hash structure in HashJoinRowBuffer.
Definition: hash_join_buffer.h:107
Key BufferRow
Definition: hash_join_buffer.h:129
void LoadImmutableStringIntoTableBuffers(const TableCollection &tables, LinkedImmutableString row)
Definition: hash_join_buffer.cc:123
void LoadBufferRowIntoTableBuffers(const TableCollection &tables, BufferRow row)
Definition: hash_join_buffer.cc:116
StoreRowResult
Definition: hash_join_buffer.h:159
Generic routines for packing rows (possibly from multiple tables at the same time) into strings,...
required string key
Definition: replication_asynchronous_connection_failover.proto:59
Our own string classes, used pervasively throughout the executor.
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82