1#ifndef HISTOGRAMS_VALUE_MAP_INCLUDED
2#define HISTOGRAMS_VALUE_MAP_INCLUDED
52struct SingletonBucket;
54namespace equi_height {
85 return std::less<T>()(lhs, rhs);
190 virtual size_t size()
const = 0;
230 const std::string &tbl_name,
231 const std::string &col_name)
const = 0;
279 typename value_map_type::const_iterator
begin()
const {
283 typename value_map_type::const_iterator
end()
const {
303 bool insert(
typename value_map_type::const_iterator
begin,
304 typename value_map_type::const_iterator
end);
308 const std::string &tbl_name,
309 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:68
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:168
Histogram base class.
Definition: histogram.h:312
The abstract base class for all Value_map types.
Definition: value_map.h:170
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:173
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:85
double get_sampling_rate() const
Definition: value_map.h:234
void add_null_values(const ha_rows count)
Increase the number of null values with the given count.
Definition: value_map.h:209
Value_map_type get_data_type() const
Definition: value_map.h:249
virtual size_t element_overhead() const =0
ha_rows m_num_null_values
Definition: value_map.h:174
MEM_ROOT m_mem_root
Definition: value_map.h:178
double m_sampling_rate
Definition: value_map.h:172
Value_map_base(const CHARSET_INFO *charset, Value_map_type data_type)
Definition: value_map.cc:76
void set_sampling_rate(double sampling_rate)
Set the sampling rate that was used to generate this Value_map.
Definition: value_map.h:241
const CHARSET_INFO * get_character_set() const
Definition: value_map.h:246
ha_rows get_num_null_values() const
Definition: value_map.h:212
const Value_map_type m_data_type
Definition: value_map.h:175
Value_map class.
Definition: value_map.h:264
value_map_type::const_iterator end() const
Definition: value_map.h:283
size_t element_overhead() const override
Definition: value_map.h:314
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:135
bool add_values(const T &value, const ha_rows count)
Definition: value_map.cc:91
size_t size() const override
Returns the number of [value, count] pairs in the Value_map.
Definition: value_map.h:277
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:149
std::map< T, ha_rows, Histogram_comparator, Mem_root_allocator< std::pair< const T, ha_rows > > > value_map_type
Definition: value_map.h:268
value_map_type m_value_map
Definition: value_map.h:270
value_map_type::const_iterator begin() const
Definition: value_map.h:279
Value_map(const CHARSET_INFO *charset, Value_map_type data_type)
Definition: value_map.h:273
Equi-height bucket.
Definition: equi_height_bucket.h:54
const T & get_upper_inclusive() const
Definition: equi_height_bucket.h:104
const T & get_lower_inclusive() const
Definition: equi_height_bucket.h:99
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:110
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:43
Time declarations shared between the server and client API: you should not add anything to this heade...
int key_type
Definition: http_request.h:50
uint16_t value_type
Definition: vt100.h:184
const std::string charset("charset")
Definition: column_statistics.h:34
static const size_t HISTOGRAM_MAX_COMPARE_LENGTH
The maximum number of characters to evaluate when building histograms.
Definition: value_map.h:63
Value_map_type
Datatypes that a Value_map and histogram can hold (including the invalid type).
Definition: value_map_type.h:33
const char * db_name
Definition: rules_table_service.cc:55
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2893
Definition: m_ctype.h:385
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: mysql_time.h:82
Definition: completion_hash.h:40
Histogram comparator.
Definition: value_map.h:71
bool operator()(const SingletonBucket< T > &a, const SingletonBucket< T > &b) const
Same as above, but for singleton histogram buckets.
Definition: value_map.h:141
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:93
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:84
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:113
bool operator()(const T &a, const SingletonBucket< T > &b) const
Same as above, but for singleton histogram buckets.
Definition: value_map.h:121
bool operator()(const SingletonBucket< T > &a, const T &b) const
Same as above, but for singleton histogram buckets.
Definition: value_map.h:101
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:131
Definition: singleton.h:107
T value
Definition: singleton.h:108