1#ifndef HISTOGRAMS_VALUE_MAP_INCLUDED
2#define HISTOGRAMS_VALUE_MAP_INCLUDED
51struct SingletonBucket;
53namespace equi_height {
84 return std::less<T>()(lhs, rhs);
189 virtual size_t size()
const = 0;
229 const std::string &tbl_name,
230 const std::string &col_name)
const = 0;
278 typename value_map_type::const_iterator
begin()
const {
282 typename value_map_type::const_iterator
end()
const {
302 bool insert(
typename value_map_type::const_iterator
begin,
303 typename value_map_type::const_iterator
end);
307 const std::string &tbl_name,
308 const std::string &col_name)
const override;
Mem_root_allocator is a C++ STL memory allocator based on MEM_ROOT.
Definition: mem_root_allocator.h:67
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
Histogram base class.
Definition: histogram.h:312
The abstract base class for all Value_map types.
Definition: value_map.h:169
virtual 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 =0
Create a Histogram from this Value_map.
virtual size_t size() const =0
Returns the number of [value, count] pairs in the Value_map.
const CHARSET_INFO * m_charset
Definition: value_map.h:172
virtual ~Value_map_base()=default
bool add_values(const T &value, const ha_rows count)
Add a value with the given count to this Value_map.
Definition: value_map.cc:86
double get_sampling_rate() const
Definition: value_map.h:233
void add_null_values(const ha_rows count)
Increase the number of null values with the given count.
Definition: value_map.h:208
Value_map_type get_data_type() const
Definition: value_map.h:248
virtual size_t element_overhead() const =0
ha_rows m_num_null_values
Definition: value_map.h:173
MEM_ROOT m_mem_root
Definition: value_map.h:177
double m_sampling_rate
Definition: value_map.h:171
Value_map_base(const CHARSET_INFO *charset, Value_map_type data_type)
Definition: value_map.cc:77
void set_sampling_rate(double sampling_rate)
Set the sampling rate that was used to generate this Value_map.
Definition: value_map.h:240
const CHARSET_INFO * get_character_set() const
Definition: value_map.h:245
ha_rows get_num_null_values() const
Definition: value_map.h:211
const Value_map_type m_data_type
Definition: value_map.h:174
Value_map class.
Definition: value_map.h:263
value_map_type::const_iterator end() const
Definition: value_map.h:282
size_t element_overhead() const override
Definition: value_map.h:313
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.
Definition: value_map.cc:136
bool add_values(const T &value, const ha_rows count)
Definition: value_map.cc:92
size_t size() const override
Returns the number of [value, count] pairs in the Value_map.
Definition: value_map.h:276
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.
Definition: value_map.cc:150
std::map< T, ha_rows, Histogram_comparator, Mem_root_allocator< std::pair< const T, ha_rows > > > value_map_type
Definition: value_map.h:267
value_map_type m_value_map
Definition: value_map.h:269
value_map_type::const_iterator begin() const
Definition: value_map.h:278
Value_map(const CHARSET_INFO *charset, Value_map_type data_type)
Definition: value_map.h:272
Equi-height bucket.
Definition: equi_height_bucket.h:53
const T & get_upper_inclusive() const
Definition: equi_height_bucket.h:103
const T & get_lower_inclusive() const
Definition: equi_height_bucket.h:98
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:94
static MEM_ROOT mem_root
Definition: client_plugin.cc:113
A better implementation of the UNIX ctype(3) library.
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1140
static int count
Definition: myisam_ftdump.cc:44
Time declarations shared between the server and client API: you should not add anything to this heade...
int key_type
Definition: http_request.h:49
uint16_t value_type
Definition: vt100.h:183
const std::string charset("charset")
Definition: column_statistics.h:33
static const size_t HISTOGRAM_MAX_COMPARE_LENGTH
The maximum number of characters to evaluate when building histograms.
Definition: value_map.h:62
Value_map_type
Datatypes that a Value_map and histogram can hold (including the invalid type).
Definition: value_map_type.h:32
const char * db_name
Definition: rules_table_service.cc:54
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2891
Definition: m_ctype.h:422
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
Definition: mysql_time.h:81
Definition: completion_hash.h:39
Histogram comparator.
Definition: value_map.h:70
bool operator()(const SingletonBucket< T > &a, const SingletonBucket< T > &b) const
Same as above, but for singleton histogram buckets.
Definition: value_map.h:140
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 w...
Definition: value_map.h:92
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.
Definition: value_map.h:83
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 wi...
Definition: value_map.h:112
bool operator()(const T &a, const SingletonBucket< T > &b) const
Same as above, but for singleton histogram buckets.
Definition: value_map.h:120
bool operator()(const SingletonBucket< T > &a, const T &b) const
Same as above, but for singleton histogram buckets.
Definition: value_map.h:100
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.
Definition: value_map.h:130
Definition: singleton.h:106
T value
Definition: singleton.h:107