[Commits] 0984224d3ac: Valgrind fixes, poor .result fixes, code cleanups
revision-id: 0984224d3ac33836f126464a46ff744bba3c786a (mariadb-10.6.1-125-g0984224d3ac) parent(s): 2dccb706369b4e523c8fb2dcef95ac83fbd71e0a author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2021-09-10 17:16:43 +0300 message: Valgrind fixes, poor .result fixes, code cleanups - Use String::c_ptr_safe() instead of String::c_ptr - Do proper datatype conversions in Histogram_json_hb::parse - Remove Histogram_json_hb::Bucket::end_value. Introduce get_end_value() instead. --- mysql-test/main/statistics_json.result | 8 ++++---- sql/opt_histogram_json.h | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/mysql-test/main/statistics_json.result b/mysql-test/main/statistics_json.result index 75ba065f89b..3b701b89a0c 100644 --- a/mysql-test/main/statistics_json.result +++ b/mysql-test/main/statistics_json.result @@ -4013,12 +4013,12 @@ test t1_json a a-0 a-9 0.0000 3.0000 1.0000 10 JSON_HB { } explain extended select * from t1_json where a between 'a-3a' and 'zzzzzzzzz'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 10.00 Using where +1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 50.00 Using where Warnings: Note 1003 select `test`.`t1_json`.`a` AS `a` from `test`.`t1_json` where `test`.`t1_json`.`a` between 'a-3a' and 'zzzzzzzzz' analyze select * from t1_json where a between 'a-3a' and 'zzzzzzzzz'; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 10.00 10.00 60.00 Using where +1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 10.00 50.00 60.00 Using where explain extended select * from t1_json where a < 'b-1a'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 90.00 Using where @@ -4053,12 +4053,12 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f 1 SIMPLE t2 ALL NULL NULL NULL NULL 101 101.00 50.00 98.02 Using where explain extended select * from t2 where city = 'Helsinki'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 101 50.00 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 101 1.98 Using where Warnings: Note 1003 select `test`.`t2`.`city` AS `city` from `test`.`t2` where `test`.`t2`.`city` = 'Helsinki' analyze select * from t2 where city = 'helsinki'; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 101 101.00 50.00 1.98 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 101 101.00 1.98 1.98 Using where explain extended select * from t2 where city < 'Lagos'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 101 50.00 Using where diff --git a/sql/opt_histogram_json.h b/sql/opt_histogram_json.h index ed48d951a7f..83f107c13ac 100644 --- a/sql/opt_histogram_json.h +++ b/sql/opt_histogram_json.h @@ -61,9 +61,6 @@ class Histogram_json_hb : public Histogram_base // value is in this bucket. std::string start_value; - // The right endpoint. It is non-inclusive, except for the last bucket. - std::string *end_value; - // Cumulative fraction: The fraction of table rows that fall into this // and preceding buckets. double cum_fract; @@ -125,6 +122,7 @@ class Histogram_json_hb : public Histogram_base private: double get_left_fract(int idx); + std::string& get_end_value(int idx); int find_bucket(Field *field, const uchar *lookup_val, bool equal_is_less); };
participants (1)
-
psergey