summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2021-09-04 17:24:47 +0300
committerSergei Petrunia <psergey@askmonty.org>2021-09-04 17:24:47 +0300
commit57cc13d177067979dad47307dac8ea41621899c7 (patch)
tree03956cb6d7e7883733089df019de52b25fa70c9f
parent034f232e182a172847d534554cb8ed56b56c8222 (diff)
downloadmariadb-git-57cc13d177067979dad47307dac8ea41621899c7.tar.gz
More code cleanups
Remove Histogram_*::is_available(), it is not applicable anymore. Fix compilation on Windows
-rw-r--r--sql/opt_histogram_json.cc2
-rw-r--r--sql/opt_histogram_json.h10
-rw-r--r--sql/sql_statistics.cc2
-rw-r--r--sql/sql_statistics.h23
4 files changed, 11 insertions, 26 deletions
diff --git a/sql/opt_histogram_json.cc b/sql/opt_histogram_json.cc
index 196ee6f2737..cc20165b4db 100644
--- a/sql/opt_histogram_json.cc
+++ b/sql/opt_histogram_json.cc
@@ -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;
}
diff --git a/sql/opt_histogram_json.h b/sql/opt_histogram_json.h
index c5b31c273ad..3fbba8814dd 100644
--- a/sql/opt_histogram_json.h
+++ b/sql/opt_histogram_json.h
@@ -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));
}
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index dd79cc16d59..ca9fb8ae194 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -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;
}
diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h
index 7ac315f48e2..601c5bf907f 100644
--- a/sql/sql_statistics.h
+++ b/sql/sql_statistics.h
@@ -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) {