Commit 748b293c authored by Sergei Petrunia's avatar Sergei Petrunia

More test coverage

parent c2d2c1e7
...@@ -8146,3 +8146,25 @@ analyze select * from t1 where a >= 0; ...@@ -8146,3 +8146,25 @@ analyze select * from t1 where a >= 0;
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 ALL NULL NULL NULL NULL 100 100.00 100.00 100.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 100 100.00 100.00 100.00 Using where
drop table t1; drop table t1;
#
# More test coverage
#
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
create table t2 (a int);
insert into t2 select 1 from t1;
insert into t2 select (a+1)*10 from t0;
insert into t2 values (0);
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
analyze select * from t2 where a < 1;
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 1011 1011.00 8.33 0.10 Using where
analyze select * from t2 where a =100;
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 1011 1011.00 0.10 0.10 Using where
drop table t0,t1,t2;
...@@ -353,3 +353,25 @@ analyze select * from t1 where a < 0; ...@@ -353,3 +353,25 @@ analyze select * from t1 where a < 0;
analyze select * from t1 where a > 0; analyze select * from t1 where a > 0;
analyze select * from t1 where a >= 0; analyze select * from t1 where a >= 0;
drop table t1; drop table t1;
--echo #
--echo # More test coverage
--echo #
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
create table t2 (a int);
insert into t2 select 1 from t1;
insert into t2 select (a+1)*10 from t0;
insert into t2 values (0);
analyze table t2 persistent for all;
analyze select * from t2 where a < 1;
analyze select * from t2 where a =100;
drop table t0,t1,t2;
...@@ -914,7 +914,6 @@ double Histogram_json_hb::range_selectivity(Field *field, key_range *min_endp, ...@@ -914,7 +914,6 @@ double Histogram_json_hb::range_selectivity(Field *field, key_range *min_endp,
/* /*
The range is "col > $CONST" and we've found a bucket that contains The range is "col > $CONST" and we've found a bucket that contains
only the value $CONST. Move to the next bucket. only the value $CONST. Move to the next bucket.
TODO: what if the last value in the histogram is a popular one?
*/ */
idx++; idx++;
} }
...@@ -948,7 +947,6 @@ double Histogram_json_hb::range_selectivity(Field *field, key_range *min_endp, ...@@ -948,7 +947,6 @@ double Histogram_json_hb::range_selectivity(Field *field, key_range *min_endp,
/* /*
The range is "col < $CONST" and we've found a bucket starting with The range is "col < $CONST" and we've found a bucket starting with
$CONST. Move to the previous bucket. $CONST. Move to the previous bucket.
TODO: what if the first value is the popular one?
*/ */
idx--; idx--;
} }
......
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