mirror of
https://github.com/MariaDB/server.git
synced 2025-09-11 05:52:26 +03:00
BUG20733: Bug in partition pruning with zerofill field
Problem was with handling NULL values in ranges
This commit is contained in:
@@ -1,4 +1,98 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (a int unsigned)
|
||||
partition by list (a)
|
||||
(partition p0 values in (0),
|
||||
partition p1 values in (1),
|
||||
partition pnull values in (null),
|
||||
partition p2 values in (2));
|
||||
insert into t1 values (null),(0),(1),(2);
|
||||
select * from t1 where a < 2;
|
||||
a
|
||||
0
|
||||
1
|
||||
select * from t1 where a <= 0;
|
||||
a
|
||||
0
|
||||
select * from t1 where a < 1;
|
||||
a
|
||||
0
|
||||
select * from t1 where a > 0;
|
||||
a
|
||||
1
|
||||
2
|
||||
select * from t1 where a > 1;
|
||||
a
|
||||
2
|
||||
select * from t1 where a >= 0;
|
||||
a
|
||||
0
|
||||
1
|
||||
2
|
||||
select * from t1 where a >= 1;
|
||||
a
|
||||
1
|
||||
2
|
||||
select * from t1 where a is null;
|
||||
a
|
||||
NULL
|
||||
select * from t1 where a is not null;
|
||||
a
|
||||
0
|
||||
1
|
||||
2
|
||||
select * from t1 where a is null or a > 0;
|
||||
a
|
||||
1
|
||||
NULL
|
||||
2
|
||||
drop table t1;
|
||||
create table t1 (a int unsigned, b int)
|
||||
partition by list (a)
|
||||
subpartition by hash (b)
|
||||
subpartitions 2
|
||||
(partition p0 values in (0),
|
||||
partition p1 values in (1),
|
||||
partition pnull values in (null, 2),
|
||||
partition p3 values in (3));
|
||||
insert into t1 values (0,0),(0,1),(1,0),(1,1),(null,0),(null,1);
|
||||
insert into t1 values (2,0),(2,1),(3,0),(3,1);
|
||||
explain partitions select * from t1 where a is null;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 4 Using where
|
||||
select * from t1 where a is null;
|
||||
a b
|
||||
NULL 0
|
||||
NULL 1
|
||||
explain partitions select * from t1 where a = 2;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 4 Using where
|
||||
select * from t1 where a = 2;
|
||||
a b
|
||||
2 0
|
||||
2 1
|
||||
select * from t1 where a <= 0;
|
||||
a b
|
||||
0 0
|
||||
0 1
|
||||
select * from t1 where a < 3;
|
||||
a b
|
||||
0 0
|
||||
0 1
|
||||
1 0
|
||||
1 1
|
||||
2 0
|
||||
2 1
|
||||
select * from t1 where a >= 1 or a is null;
|
||||
a b
|
||||
1 0
|
||||
1 1
|
||||
NULL 0
|
||||
2 0
|
||||
NULL 1
|
||||
2 1
|
||||
3 0
|
||||
3 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a int not null,
|
||||
b int not null,
|
||||
|
Reference in New Issue
Block a user