MySQL 8.0.39
Source Code Documentation
histograms::Histogram_comparator Struct Reference

Histogram comparator. More...

#include <value_map.h>

Public Member Functions

template<class T >
bool operator() (const T &lhs, const T &rhs) const
 Overload operator(), so that we can use this struct as a custom comparator in std classes/functions. More...
 
template<class T >
bool operator() (const equi_height::Bucket< T > &a, const T &b) const
 Used by std::lower_bound when computing equal-to and less-than selectivity to find the first bucket with an upper bound that is not less than b. More...
 
template<class T >
bool operator() (const SingletonBucket< T > &a, const T &b) const
 Same as above, but for singleton histogram buckets. More...
 
template<class T >
bool operator() (const T &a, const equi_height::Bucket< T > &b) const
 Used by std::upper_bound when computing greater-than selectivity in order to find the first bucket with an upper bound that is greater than a. More...
 
template<class T >
bool operator() (const T &a, const SingletonBucket< T > &b) const
 Same as above, but for singleton histogram buckets. More...
 
template<class T >
bool operator() (const equi_height::Bucket< T > &a, const equi_height::Bucket< T > &b) const
 Used by std::is_sorted to verify that equi-height histogram buckets are stored in sorted order. More...
 
template<class T >
bool operator() (const SingletonBucket< T > &a, const SingletonBucket< T > &b) const
 Same as above, but for singleton histogram buckets. More...
 
template<>
bool operator() (const String &lhs, const String &rhs) const
 
template<>
bool operator() (const MYSQL_TIME &lhs, const MYSQL_TIME &rhs) const
 
template<>
bool operator() (const my_decimal &lhs, const my_decimal &rhs) const
 

Detailed Description

Histogram comparator.

Typical usage is in a "value map", where we for instance need to sort based on string collation and similar.

Member Function Documentation

◆ operator()() [1/10]

template<class T >
bool histograms::Histogram_comparator::operator() ( const equi_height::Bucket< T > &  a,
const equi_height::Bucket< T > &  b 
) const
inline

Used by std::is_sorted to verify that equi-height histogram buckets are stored in sorted order.

We consider bucket a = [a1, a2] to be less than bucket b = [b1, b2] if a2 < b1.

◆ operator()() [2/10]

template<class T >
bool histograms::Histogram_comparator::operator() ( const equi_height::Bucket< T > &  a,
const T &  b 
) const
inline

Used by std::lower_bound when computing equal-to and less-than selectivity to find the first bucket with an upper bound that is not less than b.

◆ operator()() [3/10]

template<>
bool histograms::Histogram_comparator::operator() ( const my_decimal lhs,
const my_decimal rhs 
) const

◆ operator()() [4/10]

template<>
bool histograms::Histogram_comparator::operator() ( const MYSQL_TIME lhs,
const MYSQL_TIME rhs 
) const

◆ operator()() [5/10]

template<class T >
bool histograms::Histogram_comparator::operator() ( const SingletonBucket< T > &  a,
const SingletonBucket< T > &  b 
) const
inline

Same as above, but for singleton histogram buckets.

◆ operator()() [6/10]

template<class T >
bool histograms::Histogram_comparator::operator() ( const SingletonBucket< T > &  a,
const T &  b 
) const
inline

Same as above, but for singleton histogram buckets.

◆ operator()() [7/10]

template<>
bool histograms::Histogram_comparator::operator() ( const String lhs,
const String rhs 
) const

◆ operator()() [8/10]

template<class T >
bool histograms::Histogram_comparator::operator() ( const T &  a,
const equi_height::Bucket< T > &  b 
) const
inline

Used by std::upper_bound when computing greater-than selectivity in order to find the first bucket with an upper bound that is greater than a.

Notice that the comparison function used by std::lower_bound and std::upper_bound have the collection element as the first and second argument, respectively.

◆ operator()() [9/10]

template<class T >
bool histograms::Histogram_comparator::operator() ( const T &  a,
const SingletonBucket< T > &  b 
) const
inline

Same as above, but for singleton histogram buckets.

◆ operator()() [10/10]

template<class T >
bool histograms::Histogram_comparator::operator() ( const T &  lhs,
const T &  rhs 
) const
inline

Overload operator(), so that we can use this struct as a custom comparator in std classes/functions.

Parameters
lhsfirst value to compare
rhssecond value to compare
Returns
true if lhs is considered to be smaller/less than rhs. false otherwise.

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