MySQL 9.1.0
Source Code Documentation
HashJoinChunk Class Reference

#include <hash_join_chunk.h>

Public Member Functions

 HashJoinChunk ()=default
 
 HashJoinChunk (HashJoinChunk &&other)
 
 HashJoinChunk (const HashJoinChunk &obj)=delete
 
HashJoinChunkoperator= (HashJoinChunk &&other)
 
 ~HashJoinChunk ()
 
bool Init (const pack_rows::TableCollection &tables, bool uses_match_flags=false)
 Initialize this HashJoinChunk. More...
 
ha_rows NumRows () const
 
void SetNumRows (ha_rows no)
 Set the number of rows we currently care about in this chunk. More...
 
bool WriteRowToChunk (String *buffer, bool matched, size_t file_set_no=std::numeric_limits< size_t >::max())
 Write a row to the HashJoinChunk. More...
 
bool LoadRowFromChunk (String *buffer, bool *matched, size_t *file_set_no=nullptr)
 Read a row from the HashJoinChunk and put it in the record buffer. More...
 
bool Rewind ()
 Flush the file buffer, and prepare the file for reading. More...
 
bool SetAppend ()
 Switch from reading to writing, saving current read position m_last_read_pos. More...
 
bool ContinueRead ()
 Switch from writing to reading, saving current write position in m_last_write_pos. More...
 

Private Attributes

pack_rows::TableCollection m_tables
 
ha_rows m_num_rows {0}
 
IO_CACHE m_file
 
bool m_uses_match_flags {false}
 
size_t m_last_write_pos {0}
 
size_t m_last_read_pos {0}
 

Constructor & Destructor Documentation

◆ HashJoinChunk() [1/3]

HashJoinChunk::HashJoinChunk ( )
default

◆ HashJoinChunk() [2/3]

HashJoinChunk::HashJoinChunk ( HashJoinChunk &&  other)

◆ HashJoinChunk() [3/3]

HashJoinChunk::HashJoinChunk ( const HashJoinChunk obj)
delete

◆ ~HashJoinChunk()

HashJoinChunk::~HashJoinChunk ( )

Member Function Documentation

◆ ContinueRead()

bool HashJoinChunk::ContinueRead ( )

Switch from writing to reading, saving current write position in m_last_write_pos.

Continue reading from m_last_read_pos.

Return values
trueon error

◆ Init()

bool HashJoinChunk::Init ( const pack_rows::TableCollection tables,
bool  uses_match_flags = false 
)

Initialize this HashJoinChunk.

Parameters
tablesThe tables to store row data from. Which column we store in the chunk file is determined by each tables read set.
uses_match_flagsWhether each row should be prefixed with a match flag, saying whether the row had a matching row.
Returns
true if the initialization failed.

◆ LoadRowFromChunk()

bool HashJoinChunk::LoadRowFromChunk ( String buffer,
bool *  matched,
size_t *  file_set_no = nullptr 
)

Read a row from the HashJoinChunk and put it in the record buffer.

The function will read a row from file on disk and put it in the record buffers (table->record[0]) in the provided tables. The file on disk should already be pointing to the start of a row.

Parameters
buffera buffer that is used when copying data from the chunk file to the tables. Note that any existing data in "buffer" is overwritten.
[out]matchedwhether this row has seen a matching row from the other input. The flag is only restored if 'm_uses_match_flags' is set, and if the row comes from the probe input.
file_set_noUsed by set operations only: the zero based chunk file set number. If not nullptr, set this to current set file number. Note: If WriteRowToChunk used a non ignorable file_set_no, it is expected that a non nullptr value be provided here for reading of rows to proceed correctly.
Return values
trueon error.

◆ NumRows()

ha_rows HashJoinChunk::NumRows ( ) const
inline
Returns
the number of rows in this chunk

◆ operator=()

HashJoinChunk & HashJoinChunk::operator= ( HashJoinChunk &&  other)

◆ Rewind()

bool HashJoinChunk::Rewind ( )

Flush the file buffer, and prepare the file for reading.

Return values
trueon error

◆ SetAppend()

bool HashJoinChunk::SetAppend ( )

Switch from reading to writing, saving current read position m_last_read_pos.

Continue writing from m_last_write_pos.

Return values
trueon error

◆ SetNumRows()

void HashJoinChunk::SetNumRows ( ha_rows  no)
inline

Set the number of rows we currently care about in this chunk.

Used to keep track of number of rows written from a certain point in time (the counter is incremented by writing).

Parameters
nothe number to set the counter to

◆ WriteRowToChunk()

bool HashJoinChunk::WriteRowToChunk ( String buffer,
bool  matched,
size_t  file_set_no = std::numeric_limits<size_t>::max() 
)

Write a row to the HashJoinChunk.

Read the row that lies in the record buffer (record[0]) of the given tables and write it out to the underlying file. If the QEP_TAB signals that the row ID should be kept, it is also written out. Note that TABLE::read_set is used to signal which columns that should be written to the chunk.

Parameters
buffera buffer that is used when copying data from the tables to the chunk file. Note that any existing data in "buffer" is overwritten.
matchedwhether this row has seen a matching row from the other input. The flag is only written if 'm_uses_match_flags' is set, and if the row comes from the probe input.
file_set_noUsed by set operations only: the zero based chunk file set number. If equal to std::numeric_limits<size_t>::max(), ignore ( default value).
Return values
trueon error.

Member Data Documentation

◆ m_file

IO_CACHE HashJoinChunk::m_file
private

◆ m_last_read_pos

size_t HashJoinChunk::m_last_read_pos {0}
private

◆ m_last_write_pos

size_t HashJoinChunk::m_last_write_pos {0}
private

◆ m_num_rows

ha_rows HashJoinChunk::m_num_rows {0}
private

◆ m_tables

pack_rows::TableCollection HashJoinChunk::m_tables
private

◆ m_uses_match_flags

bool HashJoinChunk::m_uses_match_flags {false}
private

The documentation for this class was generated from the following files: