MySQL 8.0.29
Source Code Documentation
hash_join_buffer Namespace Reference


class  HashJoinRowBuffer
class  KeyEquals
class  KeyHasher


using Key = std::string_view
 The key type for the hash structure in HashJoinRowBuffer. More...
using BufferRow = Key


enum class  StoreRowResult { ROW_STORED , BUFFER_FULL , FATAL_ERROR }


void LoadBufferRowIntoTableBuffers (const TableCollection &tables, BufferRow row)
void LoadImmutableStringIntoTableBuffers (const TableCollection &tables, LinkedImmutableString row)

Typedef Documentation

◆ BufferRow

◆ Key

using hash_join_buffer::Key = typedef std::string_view

The key type for the hash structure in HashJoinRowBuffer.

A key consists of the value from one or more columns, taken from the join condition(s) in the query. E.g., if the join condition is (t1.col1 = t2.col1 AND t1.col2 = t2.col2), the key is (col1, col2), with the two key parts concatenated together.

What the data actually contains depends on the comparison context for the join condition. For instance, if the join condition is between a string column and an integer column, the comparison will be done in a string context, and thus the integers will be converted to strings before storing. So the data we store in the key are in some cases converted, so that we can hash and compare them byte-by-byte (i.e. decimals), while other types are already comparable byte-by-byte (i.e. integers), and thus stored as-is.

Note that the key data can come from items as well as fields if the join condition is an expression. E.g. if the join condition is UPPER(t1.col1) = UPPER(t2.col1), the join key data will come from an Item instead of a Field.

The Key class never takes ownership of the data. As such, the user must ensure that the data has the proper lifetime. When storing rows in the row buffer, the data must have the same lifetime as the row buffer itself. When using the Key class for lookups in the row buffer, the same lifetime is not needed; the key object is only needed when the lookup is done.

Enumeration Type Documentation

◆ StoreRowResult


Function Documentation

◆ LoadBufferRowIntoTableBuffers()

void hash_join_buffer::LoadBufferRowIntoTableBuffers ( const TableCollection tables,
BufferRow  row 

◆ LoadImmutableStringIntoTableBuffers()

void hash_join_buffer::LoadImmutableStringIntoTableBuffers ( const TableCollection tables,
LinkedImmutableString  row