1#ifndef HISTOGRAMS_SINGLETON_INCLUDED
2#define HISTOGRAMS_SINGLETON_INCLUDED
102struct Histogram_comparator;
135 const std::string &tbl_name,
136 const std::string &col_name,
261 const std::string &tbl_name,
const std::string &col_name,
Represents a JSON array container, i.e.
Definition: json_dom.h:516
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:369
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
Error context to validate given JSON object which represents a histogram.
Definition: histogram.h:209
Histogram base class.
Definition: histogram.h:314
Definition: singleton.h:115
static Singleton< 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)
Singleton histogram factory method.
Definition: singleton.cc:61
size_t get_num_buckets() const override
Definition: singleton.h:177
double get_less_than_selectivity(const T &value) const
Find the number of values less than 'value'.
Definition: singleton.cc:412
bool build_histogram(const Value_map< T > &value_map, size_t num_buckets)
Build the Singleton histogram.
Definition: singleton.cc:90
bool json_to_histogram(const Json_object &json_object, Error_context *context) override
Populate this histogram with contents from a JSON object.
Definition: singleton.cc:265
size_t get_num_distinct_values() const override
Get the estimated number of distinct non-NULL values.
Definition: singleton.h:187
double get_equal_to_selectivity(const T &value) const
Find the number of values equal to 'value'.
Definition: singleton.cc:389
Mem_root_array< SingletonBucket< T > > m_buckets
The buckets for this histogram [value, cumulative frequency].
Definition: singleton.h:300
static bool create_json_bucket(const SingletonBucket< T > &bucket, Json_array *json_bucket)
Convert one bucket to a JSON object.
Definition: singleton.cc:173
bool histogram_to_json(Json_object *json_object) const override
Convert this histogram to a JSON object.
Definition: singleton.cc:145
double get_greater_than_selectivity(const T &value) const
Find the number of values greater than 'value'.
Definition: singleton.cc:428
Singleton(const Singleton< T > &other)=delete
static bool add_value_json_bucket(const T &value, Json_array *json_bucket)
Add value to a JSON bucket.
std::string histogram_type_to_str() const override
Returns the histogram type as a readable string.
Definition: singleton.cc:260
Histogram * clone(MEM_ROOT *mem_root) const override
Make a clone of this histogram on a MEM_ROOT.
Definition: singleton.cc:380
static constexpr const char * singleton_str()
String representation of the histogram type SINGLETON.
Definition: singleton.h:246
Value_map class.
Definition: value_map.h:264
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
It is interface module to fixed precision decimals library.
Some integer typedefs for easier portability.
Time declarations shared between the server and client API: you should not add anything to this heade...
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
Our own string classes, used pervasively throughout the executor.
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: completion_hash.h:40
Definition: singleton.h:107
SingletonBucket(T value, double cumulative_frequency)
Definition: singleton.h:110
T value
Definition: singleton.h:108
double cumulative_frequency
Definition: singleton.h:109