More code cleanups

Remove Histogram_*::is_available(), it is not applicable anymore.
Fix compilation on Windows
This commit is contained in:
Sergei Petrunia 2021-09-04 17:24:47 +03:00
parent 1d98168547
commit 9271bd17f7
4 changed files with 11 additions and 26 deletions

View File

@ -126,7 +126,7 @@ void Histogram_json_hb::init_for_collection(MEM_ROOT *mem_root,
ulonglong size_arg)
{
DBUG_ASSERT(htype_arg == JSON_HB);
size= (uint8) size_arg;
size= (size_t)size_arg;
}

View File

@ -69,14 +69,6 @@ public:
void init_for_collection(MEM_ROOT *mem_root, Histogram_type htype_arg,
ulonglong size) override;
bool is_available() override {return true; }
bool is_usable(THD *thd) override
{
return thd->variables.optimizer_use_condition_selectivity > 3 &&
is_available();
}
double point_selectivity(Field *field, key_range *endpoint,
double avg_selection) override;
double range_selectivity(Field *field, key_range *min_endp,
@ -84,7 +76,7 @@ public:
void set_json_text(ulonglong sz, uchar *json_text_arg)
{
size = (uint8) sz;
size= (size_t) sz;
json_text.assign((const char*)json_text_arg,
strlen((const char*)json_text_arg));
}

View File

@ -1271,7 +1271,7 @@ void Histogram_binary::init_for_collection(MEM_ROOT *mem_root,
ulonglong size_arg)
{
type= htype_arg;
values = (uchar*)alloc_root(mem_root, size_arg);
values= (uchar*)alloc_root(mem_root, (size_t)size_arg);
size= (uint8) size_arg;
}

View File

@ -175,9 +175,15 @@ public:
virtual Histogram_builder *create_builder(Field *col, uint col_len,
ha_rows rows)=0;
virtual bool is_available()=0;
/*
This function checks that histograms should be usable only when
1) the level of optimizer_use_condition_selectivity > 3
*/
bool is_usable(THD *thd)
{
return thd->variables.optimizer_use_condition_selectivity > 3;
}
virtual bool is_usable(THD *thd)=0;
virtual double point_selectivity(Field *field, key_range *endpoint,
double avg_selection)=0;
@ -312,19 +318,6 @@ public:
Histogram_builder *create_builder(Field *col, uint col_len,
ha_rows rows) override;
bool is_available() override { return (values!=NULL); }
/*
This function checks that histograms should be usable only when
1) the level of optimizer_use_condition_selectivity > 3
2) histograms have been collected
*/
bool is_usable(THD *thd) override
{
return thd->variables.optimizer_use_condition_selectivity > 3 &&
is_available();
}
void set_value(uint i, double val)
{
switch (type) {