MySQL  8.0.28
Source Code Documentation
pack_rows Namespace Reference

Classes

struct  Column
 A class that represents a field, which also holds a cached value of the field's data type. More...
 
struct  Table
 This struct is primarily used for holding the extracted columns in a hash join. More...
 
class  TableCollection
 A structure that contains a list of tables for the hash join operation, and some pre-computed properties for the tables. More...
 

Functions

static size_t CalculateColumnStorageSize (const Column &column)
 
size_t ComputeRowSizeUpperBound (const TableCollection &tables)
 Count up how many bytes a single row from the given tables will occupy, in "packed" format. More...
 
bool StoreFromTableBuffers (const TableCollection &tables, String *buffer)
 Take the data marked for reading in "tables" and store it in the provided buffer. More...
 
const ucharLoadIntoTableBuffers (const TableCollection &tables, const uchar *ptr)
 Take the data in "ptr" and put it back to the tables' record buffers. More...
 
void RequestRowId (const Prealloced_array< pack_rows::Table, 4 > &tables, table_map tables_to_get_rowid_for)
 For each of the given tables, request that the row ID is filled in (the equivalent of calling file->position()) if needed. More...
 
void PrepareForRequestRowId (const Prealloced_array< Table, 4 > &tables, table_map tables_to_get_rowid_for)
 
static bool ShouldCopyRowId (const TABLE *table)
 
static ALWAYS_INLINE ucharStoreFromTableBuffersRaw (const TableCollection &tables, uchar *dptr)
 

Function Documentation

◆ CalculateColumnStorageSize()

static size_t pack_rows::CalculateColumnStorageSize ( const Column column)
static

◆ ComputeRowSizeUpperBound()

size_t pack_rows::ComputeRowSizeUpperBound ( const TableCollection tables)

Count up how many bytes a single row from the given tables will occupy, in "packed" format.

Note that this is an upper bound, so the length after calling Field::pack may very well be shorter than the size returned by this function.

The value returned from this function will sum up 1) The row-id if that is to be kept. 2) Size of the NULL flags. 3) Size of the buffer returned by pack() on all columns marked in the read_set.

Note that if any of the tables has a BLOB/TEXT column, this function looks at the data stored in the record buffers. This means that the function can not be called before reading any rows if tables.has_blob_column is true.

◆ LoadIntoTableBuffers()

const uchar * pack_rows::LoadIntoTableBuffers ( const TableCollection tables,
const uchar ptr 
)

Take the data in "ptr" and put it back to the tables' record buffers.

The tables must be exactly the same as when the row was created. That is, it must contain the same tables in the same order, and the read set of each table must be identical when storing and restoring the row. If that's not the case, you will end up with undefined and unpredictable behavior.

Returns a pointer to where we ended reading.

◆ PrepareForRequestRowId()

void pack_rows::PrepareForRequestRowId ( const Prealloced_array< Table, 4 > &  tables,
table_map  tables_to_get_rowid_for 
)

◆ RequestRowId()

void pack_rows::RequestRowId ( const Prealloced_array< pack_rows::Table, 4 > &  tables,
table_map  tables_to_get_rowid_for 
)

For each of the given tables, request that the row ID is filled in (the equivalent of calling file->position()) if needed.

Parameters
tablesAll tables involved in the hash join.
tables_to_get_rowid_forA bitmap of which tables to actually get row IDs for. (A table needs to be in both sets to be processed.)

◆ ShouldCopyRowId()

static bool pack_rows::ShouldCopyRowId ( const TABLE table)
static

◆ StoreFromTableBuffers()

bool pack_rows::StoreFromTableBuffers ( const TableCollection tables,
String buffer 
)

Take the data marked for reading in "tables" and store it in the provided buffer.

What data to store is determined by the read set of each table. Note that any existing data in "buffer" will be overwritten.

The output buffer will contain three things:

1) NULL flags for each nullable column. 2) The row ID for each row. This is only stored if QEP_TAB::rowid_status != NO_ROWID_NEEDED. 3) The actual data from the columns.

Return values
trueif error, false otherwise

◆ StoreFromTableBuffersRaw()

static ALWAYS_INLINE uchar* pack_rows::StoreFromTableBuffersRaw ( const TableCollection tables,
uchar dptr 
)
static