MySQL  8.0.19
Source Code Documentation
histograms::Value_map< T > Class Template Reference

Value_map class. More...

#include <histogram.h>

Public Member Functions

 Value_map (const CHARSET_INFO *charset, Value_map_type data_type, double sampling_rate=0.0)
 
size_t size () const override
 
value_map_type::const_iterator begin () const
 
value_map_type::const_iterator end () const
 
bool add_values (const T &value, const ha_rows count)
 
bool insert (typename value_map_type::const_iterator begin, typename value_map_type::const_iterator end)
 Insert a range of values into the Value_map. More...
 
virtual Histogrambuild_histogram (MEM_ROOT *mem_root, size_t num_buckets, const std::string &db_name, const std::string &tbl_name, const std::string &col_name) const override
 
size_t element_overhead () const override
 
bool add_values (const String &value, const ha_rows count)
 

Private Types

using value_map_type = std::map< T, ha_rows, Histogram_comparator, Memroot_allocator< std::pair< const T, ha_rows > >>
 

Private Attributes

value_map_type m_value_map
 

Detailed Description

template<class T>
class histograms::Value_map< T >

Value_map class.

This class works as a map. It is a collection of [key, count], where "count" is the number of occurances of "key". The class abstracts away things like duplicate checking and the underlying container.

Member Typedef Documentation

◆ value_map_type

template<class T >
using histograms::Value_map< T >::value_map_type = std::map<T, ha_rows, Histogram_comparator, Memroot_allocator<std::pair<const T, ha_rows> >>
private

Constructor & Destructor Documentation

◆ Value_map()

template<class T >
histograms::Value_map< T >::Value_map ( const CHARSET_INFO charset,
Value_map_type  data_type,
double  sampling_rate = 0.0 
)
inline

Member Function Documentation

◆ add_values() [1/2]

bool histograms::Value_map< String >::add_values ( const String value,
const ha_rows  count 
)

◆ add_values() [2/2]

template<class T >
bool histograms::Value_map< T >::add_values ( const T &  value,
const ha_rows  count 
)

◆ begin()

template<class T >
value_map_type::const_iterator histograms::Value_map< T >::begin ( ) const
inline

◆ build_histogram()

template<class T >
Histogram * histograms::Value_map< T >::build_histogram ( MEM_ROOT mem_root,
size_t  num_buckets,
const std::string &  db_name,
const std::string &  tbl_name,
const std::string &  col_name 
) const
overridevirtual

◆ element_overhead()

template<class T >
size_t histograms::Value_map< T >::element_overhead ( ) const
inlineoverride
Returns
the overhead in bytes for each distinct value stored in the Value_map. The value 32 is obtained from both GCC 8.2 and Clang 8.0 (same as sizeof(value_map_type::node_type) in C++17).

◆ end()

template<class T >
value_map_type::const_iterator histograms::Value_map< T >::end ( ) const
inline

◆ insert()

template<class T >
bool histograms::Value_map< T >::insert ( typename value_map_type::const_iterator  begin,
typename value_map_type::const_iterator  end 
)

Insert a range of values into the Value_map.

Values in the range (begin, end] must be sorted according to Histogram_comparator. Note that this function is currently only used in unit testing.

Note
The value map must be empty before calling this function.
Parameters
beginIterator that points to the beginning of the range.
endIterator that points to the end of the range.
Returns
false on success, true on error (OOM or similar).

◆ size()

template<class T >
size_t histograms::Value_map< T >::size ( ) const
inlineoverride

Member Data Documentation

◆ m_value_map

template<class T >
value_map_type histograms::Value_map< T >::m_value_map
private

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