MySQL 8.3.0
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 or BKA join, or the input columns in a streaming aggregation operation. More...
 
class  TableCollection
 A structure that contains a list of input tables for a hash join operation, BKA join operation or a streaming aggregation operation, and some pre-computed properties for the tables. More...
 

Enumerations

enum class  NullRowFlag { kNotNull , kNullWithoutData , kNullWithData }
 Possible values of the NULL-row flag stored by StoreFromTableBuffers(). 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)
 
bool ShouldCopyRowId (const TABLE *table)
 
ALWAYS_INLINE ucharStoreFromTableBuffersRaw (const TableCollection &tables, uchar *dptr)
 

Enumeration Type Documentation

◆ NullRowFlag

enum class pack_rows::NullRowFlag
strong

Possible values of the NULL-row flag stored by StoreFromTableBuffers().

It tells whether or not a row is a NULL-complemented row in which all column values (including non-nullable columns) are NULL. Additionally, in case it is a NULL-complemented row, the flag contains information about whether the buffer contains the actual non-NULL values that were available in the record buffer at the time the row was stored, or if no column values are stored for the NULL-complemented row. Usually, no values are stored for NULL-complemented rows, but it may be necessary in order to avoid corrupting the internal cache of EQRefIterator. See Table::store_contents_of_null_rows.

Enumerator
kNotNull 

The row is not a NULL-complemented one.

kNullWithoutData 

The row is NULL-complemented. No column values are stored in the buffer.

kNullWithData 

The row is NULL-complemented.

The actual non-NULL values that were in the record buffer at the time StoreFromTableBuffers() was called, will however be available in the buffer.

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. This includes:

  • Space for a NULL flag per nullable column.
  • Space for a NULL flag per nullable table (tables on the inner side of an outer join). 3) Size of the buffer returned by pack() on all columns marked in the read_set_internal.

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 operation.
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()

bool pack_rows::ShouldCopyRowId ( const TABLE table)
inline

◆ 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 the following data for each table in "tables":

1) NULL-row flag if the table is nullable. 2) NULL flags for each nullable column. 3) The actual data from the columns. 4) The row ID for each row. This is only stored if the optimizer requested row IDs when creating the TableCollection.

Return values
trueif error, false otherwise

◆ StoreFromTableBuffersRaw()

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