Commit 9bba5955 authored by Michael Okoko's avatar Michael Okoko Committed by Sergei Petrunia

remove unneeded shared methods

Signed-off-by: default avatarMichael Okoko <okokomichaels@outlook.com>
parent 1fa7af74
......@@ -1086,7 +1086,7 @@ class Column_stat: public Stat_table
// Note: this is dumb. the histogram size is stored with the
// histogram!
stat_field->store(stats->histogram_?
stats->histogram_->get_size() : 0);
stats->histogram_->get_width() : 0);
break;
case COLUMN_STAT_HIST_TYPE:
if (stats->histogram_)
......@@ -1256,7 +1256,6 @@ bool Histogram_binary::parse(MEM_ROOT *mem_root, Histogram_type type_arg, const
return false;
}
/*
Save the histogram data info a table field.
*/
......@@ -1268,7 +1267,7 @@ void Histogram_binary::serialize(Field *field)
&my_charset_bin);
}
else
field->store((char*)get_values(), get_size(), &my_charset_bin);
field->store((char*)get_values(), get_width(), &my_charset_bin);
}
void Histogram_binary::init_for_collection(MEM_ROOT *mem_root,
......@@ -1287,6 +1286,7 @@ void Histogram_json::init_for_collection(MEM_ROOT *mem_root, Histogram_type htyp
values = (uchar*)alloc_root(mem_root, size_arg);
size = (uint8) size_arg;
}
/*
An object of the class Index_stat is created to read statistical
data on tables from the statistical table table_stat, to update
......@@ -2641,18 +2641,19 @@ bool Column_statistics_collected::add()
/*
Create an empty Histogram_binary object from histogram_type.
Create an empty Histogram object from histogram_type.
Note: it is not yet clear whether collection-time histogram should be the same
as lookup-time histogram. At the moment, they are.
*/
Histogram_binary * get_histogram_by_type(MEM_ROOT *mem_root, Histogram_type hist_type) {
Histogram_base * get_histogram_by_type(MEM_ROOT *mem_root, Histogram_type hist_type) {
switch (hist_type) {
case SINGLE_PREC_HB:
case DOUBLE_PREC_HB:
case JSON:
return new Histogram_binary();
case JSON:
return new Histogram_json();
default:
DBUG_ASSERT(0);
}
......
......@@ -171,11 +171,6 @@ class Histogram_base : public Sql_alloc
virtual double range_selectivity(double min_pos, double max_pos)=0;
virtual double point_selectivity(double pos, double avg_selection)=0;
// Legacy: return the size of the histogram on disk.
// This will be stored in mysql.column_stats.hist_size column.
// Newer, JSON-based histograms may return 0.
virtual uint get_size()=0;
virtual ~Histogram_base(){}
};
......@@ -189,8 +184,6 @@ class Histogram_binary : public Histogram_base
Histogram_type get_type() override { return type; }
uint get_size() override { return (uint) size; }
uint get_width() override
{
switch (type) {
......@@ -283,7 +276,7 @@ class Histogram_binary : public Histogram_base
void set_values (uchar *vals) override { values= (uchar *) vals; }
void set_size (ulonglong sz) override { size= (uint8) sz; }
bool is_available() override { return get_size() > 0 && get_values(); }
bool is_available() override { return get_width() > 0 && get_values(); }
/*
This function checks that histograms should be usable only when
......@@ -354,8 +347,6 @@ class Histogram_json : public Histogram_base
void serialize(Field *to_field) override{}
uint get_size() override {return (uint) size;}
// returns number of buckets in the histogram
uint get_width() override
{
......@@ -371,7 +362,7 @@ class Histogram_json : public Histogram_base
void init_for_collection(MEM_ROOT *mem_root, Histogram_type htype_arg, ulonglong size) override;
bool is_available() override {return get_size() > 0 && get_values(); }
bool is_available() override {return get_width() > 0 && get_values(); }
bool is_usable(THD *thd) override
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment