1#ifndef HISTOGRAMS_EQUI_HEIGHT_INCLUDED
2#define HISTOGRAMS_EQUI_HEIGHT_INCLUDED
89struct Histogram_comparator;
97namespace equi_height {
123 const std::string &tbl_name,
124 const std::string &col_name,
258 const std::string &tbl_name,
const std::string &col_name,
Represents a JSON array container, i.e.
Definition: json_dom.h:513
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:367
Mem_root_allocator is a C++ STL memory allocator based on MEM_ROOT.
Definition: mem_root_allocator.h:68
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
Definition: equi_height.h:103
double get_less_than_selectivity(const T &value) const
Find the fraction of values that is less than 'value'.
Definition: equi_height.cc:720
Equi_height(const Equi_height< T > &other)=delete
Histogram * clone(MEM_ROOT *mem_root) const override
Make a clone of this histogram on a MEM_ROOT.
Definition: equi_height.cc:657
Mem_root_array< equi_height::Bucket< T > > m_buckets
The buckets for this histogram.
Definition: equi_height.h:289
size_t get_num_buckets() const override
Definition: equi_height.h:191
bool histogram_to_json(Json_object *json_object) const override
Convert this histogram to a JSON object.
Definition: equi_height.cc:468
std::string histogram_type_to_str() const override
Returns the histogram type as a readable string.
Definition: equi_height.cc:496
static Equi_height< T > * create(MEM_ROOT *mem_root, const std::string &db_name, const std::string &tbl_name, const std::string &col_name, Value_map_type data_type)
Equi-height histogram factory method.
Definition: equi_height.cc:66
static constexpr const char * equi_height_str()
String representation of the histogram type EQUI-HEIGHT.
Definition: equi_height.h:243
double get_equal_to_selectivity(const T &value) const
Find the fraction of values equal to 'value'.
Definition: equi_height.cc:682
const Mem_root_array< equi_height::Bucket< T > > & get_buckets() const
Get the buckets of the histogram.
Definition: equi_height.h:218
double get_greater_than_selectivity(const T &value) const
Find the fraction of values that is greater than 'value'.
Definition: equi_height.cc:770
size_t get_num_distinct_values() const override
Get the estimated number of distinct non-NULL values.
Definition: equi_height.cc:673
bool add_bucket_from_json(const Json_array *json_bucket, Error_context *context)
Create Equi-height buckets from a JSON array.
Definition: equi_height.cc:565
bool build_histogram(const Value_map< T > &value_map, size_t num_buckets)
Build the histogram.
Definition: equi_height.cc:349
bool json_to_histogram(const Json_object &json_object, Error_context *context) override
Populate this histogram with contents from a JSON object.
Definition: equi_height.cc:501
Error context to validate given JSON object which represents a histogram.
Definition: histogram.h:209
Histogram base class.
Definition: histogram.h:314
Value_map class.
Definition: value_map.h:264
Equi-height bucket.
Definition: equi_height_bucket.h:54
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
Definition: column_statistics.h:34
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
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83