MySQL 8.0.39
Source Code Documentation
|
Value_map class. More...
#include <value_map.h>
Public Member Functions | |
Value_map (const CHARSET_INFO *charset, Value_map_type data_type) | |
size_t | size () const override |
Returns the number of [value, count] pairs in the Value_map. More... | |
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... | |
Histogram * | 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 override |
Create a Histogram from this Value_map. More... | |
size_t | element_overhead () const override |
bool | add_values (const String &value, const ha_rows count) |
Public Member Functions inherited from histograms::Value_map_base | |
Value_map_base (const CHARSET_INFO *charset, Value_map_type data_type) | |
virtual | ~Value_map_base ()=default |
template<class T > | |
bool | add_values (const T &value, const ha_rows count) |
Add a value with the given count to this Value_map. More... | |
void | add_null_values (const ha_rows count) |
Increase the number of null values with the given count. More... | |
ha_rows | get_num_null_values () const |
double | get_sampling_rate () const |
void | set_sampling_rate (double sampling_rate) |
Set the sampling rate that was used to generate this Value_map. More... | |
const CHARSET_INFO * | get_character_set () const |
Value_map_type | get_data_type () const |
Private Types | |
using | value_map_type = std::map< T, ha_rows, Histogram_comparator, Mem_root_allocator< std::pair< const T, ha_rows > > > |
Private Attributes | |
value_map_type | m_value_map |
Additional Inherited Members | |
Protected Attributes inherited from histograms::Value_map_base | |
MEM_ROOT | m_mem_root |
Value_map class.
This class works as a map. It is a collection of [key, count], where "count" is the number of occurrences of "key". The class abstracts away things like duplicate checking and the underlying container.
|
private |
|
inline |
bool histograms::Value_map< String >::add_values | ( | const String & | value, |
const ha_rows | count | ||
) |
bool histograms::Value_map< T >::add_values | ( | const T & | value, |
const ha_rows | count | ||
) |
|
inline |
|
overridevirtual |
Create a Histogram from this Value_map.
The resulting histogram will have at most "num_buckets" buckets (might be less), and all of its contents will be allocated on the supplied MEM_ROOT.
mem_root | The MEM_ROOT to allocate the contents on |
num_buckets | Maximum number of buckets to create |
db_name | Database name |
tbl_name | Table name |
col_name | Column name |
Implements histograms::Value_map_base.
|
inlineoverridevirtual |
Implements histograms::Value_map_base.
|
inline |
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.
begin | Iterator that points to the beginning of the range. |
end | Iterator that points to the end of the range. |
|
inlineoverridevirtual |
Returns the number of [value, count] pairs in the Value_map.
Implements histograms::Value_map_base.
|
private |