MySQL 8.0.32
Source Code Documentation
HalfCounter Class Reference

Auxiliary class to squeeze two 32 bits integers into a 64 bits one, cf. More...

#include <basic_row_iterators.h>

Public Member Functions

 HalfCounter (uint64_t packed)
 
uint64_t value () const
 
uint32_t & operator[] (size_t idx)
 

Private Attributes

union {
   uint32_t   m_value [2]
 [0]: # of duplicates on left side of INTERSECT ALL [1]: # of duplicates on right side of INTERSECT ALL. More...
 
   uint64_t   m_value64
 
data
 

Detailed Description

Auxiliary class to squeeze two 32 bits integers into a 64 bits one, cf.

logic of INTERSECT ALL in MaterializeIterator<Profiler>::MaterializeQueryBlock. For INTERSECT ALL we need two counters: the number of duplicates in the left operand, and the number of matches seen (so far) from the right operand. Instead of adding another field to the temporary table, we subdivide the 64 bits counter we already have. This imposes an implementation restriction on INTERSECT ALL: the resulting table must have <= uint32::max duplicates of any row.

Constructor & Destructor Documentation

◆ HalfCounter()

HalfCounter::HalfCounter ( uint64_t  packed)
inline

Member Function Documentation

◆ operator[]()

uint32_t & HalfCounter::operator[] ( size_t  idx)
inline

◆ value()

uint64_t HalfCounter::value ( ) const
inline

Member Data Documentation

◆ 

union { ... } HalfCounter::data

◆ m_value

uint32_t HalfCounter::m_value[2]

[0]: # of duplicates on left side of INTERSECT ALL [1]: # of duplicates on right side of INTERSECT ALL.

Always <= [0].

◆ m_value64

uint64_t HalfCounter::m_value64

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