Commit 49a7bbb1 authored by Sergei Petrunia's avatar Sergei Petrunia

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.
parent ace961a1
...@@ -4013,12 +4013,12 @@ test t1_json a a-0 a-9 0.0000 3.0000 1.0000 10 JSON_HB { ...@@ -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'; 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 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: Warnings:
Note 1003 select `test`.`t1_json`.`a` AS `a` from `test`.`t1_json` where `test`.`t1_json`.`a` between 'a-3a' and 'zzzzzzzzz' 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'; 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 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'; explain extended select * from t1_json where a < 'b-1a';
id select_type table type possible_keys key key_len ref rows filtered Extra 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 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 ...@@ -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 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'; explain extended select * from t2 where city = 'Helsinki';
id select_type table type possible_keys key key_len ref rows filtered Extra 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: Warnings:
Note 1003 select `test`.`t2`.`city` AS `city` from `test`.`t2` where `test`.`t2`.`city` = 'Helsinki' Note 1003 select `test`.`t2`.`city` AS `city` from `test`.`t2` where `test`.`t2`.`city` = 'Helsinki'
analyze select * from t2 where 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 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'; explain extended select * from t2 where city < 'Lagos';
id select_type table type possible_keys key key_len ref rows filtered Extra 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 50.00 Using where
......
...@@ -61,9 +61,6 @@ class Histogram_json_hb : public Histogram_base ...@@ -61,9 +61,6 @@ class Histogram_json_hb : public Histogram_base
// value is in this bucket. // value is in this bucket.
std::string start_value; 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 // Cumulative fraction: The fraction of table rows that fall into this
// and preceding buckets. // and preceding buckets.
double cum_fract; double cum_fract;
...@@ -125,6 +122,7 @@ class Histogram_json_hb : public Histogram_base ...@@ -125,6 +122,7 @@ class Histogram_json_hb : public Histogram_base
private: private:
double get_left_fract(int idx); 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); int find_bucket(Field *field, const uchar *lookup_val, bool equal_is_less);
}; };
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