1#ifndef SQL_ITERATORS_HASH_JOIN_BUFFER_H_
2#define SQL_ITERATORS_HASH_JOIN_BUFFER_H_
66#include "extra/robin-hood-hashing/robin_hood.h"
102using Key = std::string_view;
114 return str1 == other.
Decode();
135 return robin_hood::hash_bytes(
key.data(),
key.size());
139 std::string_view decoded =
key.Decode();
140 return robin_hood::hash_bytes(decoded.data(), decoded.size());
161 std::vector<HashJoinCondition> join_conditions,
162 size_t max_mem_available_bytes);
264 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
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:156
String m_buffer
Definition: hash_join_buffer.h:234
bool contains(const Key &key) const
Definition: hash_join_buffer.h:208
size_t m_row_size_upper_bound
Definition: hash_join_buffer.h:235
hash_map_type::const_iterator hash_map_iterator
Definition: hash_join_buffer.h:193
hash_map_iterator end() const
Definition: hash_join_buffer.h:199
size_t size() const
Definition: hash_join_buffer.h:184
bool Init()
Definition: hash_join_buffer.cc:132
bool Initialized() const
Definition: hash_join_buffer.h:206
hash_map_iterator begin() const
Definition: hash_join_buffer.h:197
bool empty() const
Definition: hash_join_buffer.h:186
bool inited() const
Definition: hash_join_buffer.h:188
std::unique_ptr< hash_map_type > m_hash_map
Definition: hash_join_buffer.h:230
HashJoinRowBuffer(pack_rows::TableCollection tables, std::vector< HashJoinCondition > join_conditions, size_t max_mem_available_bytes)
Definition: hash_join_buffer.cc:118
LinkedImmutableString m_last_row_stored
Definition: hash_join_buffer.h:246
const std::vector< HashJoinCondition > m_join_conditions
Definition: hash_join_buffer.h:211
const size_t m_max_mem_available
Definition: hash_join_buffer.h:238
LinkedImmutableString StoreLinkedImmutableStringFromTableBuffers(LinkedImmutableString next_ptr, bool *full)
Definition: hash_join_buffer.cc:97
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:161
const pack_rows::TableCollection m_tables
Definition: hash_join_buffer.h:215
robin_hood::unordered_flat_map< ImmutableStringWithLength, LinkedImmutableString, KeyHasher, KeyEquals > hash_map_type
Definition: hash_join_buffer.h:191
LinkedImmutableString LastRowStored() const
Definition: hash_join_buffer.h:201
hash_map_iterator find(const Key &key) const
Definition: hash_join_buffer.h:195
MEM_ROOT m_overflow_mem_root
Definition: hash_join_buffer.h:227
MEM_ROOT m_mem_root
Definition: hash_join_buffer.h:219
Definition: hash_join_buffer.h:104
void is_transparent
Definition: hash_join_buffer.h:110
bool operator()(const ImmutableStringWithLength &str1, const ImmutableStringWithLength &str2) const
Definition: hash_join_buffer.h:117
bool operator()(const Key &str1, const ImmutableStringWithLength &other) const
Definition: hash_join_buffer.h:112
Definition: hash_join_buffer.h:126
size_t operator()(hash_join_buffer::Key key) const
Definition: hash_join_buffer.h:134
void is_transparent
Definition: hash_join_buffer.h:132
size_t operator()(ImmutableStringWithLength key) const
Definition: hash_join_buffer.h:138
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
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:44
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...
Definition: hash_join_buffer.cc:94
std::string_view Key
The key type for the hash structure in HashJoinRowBuffer.
Definition: hash_join_buffer.h:102
Key BufferRow
Definition: hash_join_buffer.h:124
void LoadImmutableStringIntoTableBuffers(const TableCollection &tables, LinkedImmutableString row)
Definition: hash_join_buffer.cc:113
void LoadBufferRowIntoTableBuffers(const TableCollection &tables, BufferRow row)
Definition: hash_join_buffer.cc:106
StoreRowResult
Definition: hash_join_buffer.h:154
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