set @@session.tidb_enable_table_partition=1;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
#
# Bug#53806: Wrong estimates for range query in partitioned MyISAM table
# Bug#46754: 'rows' field doesn't reflect partition pruning
#
CREATE TABLE t1 (a INT PRIMARY KEY)
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (1),
PARTITION p1 VALUES LESS THAN (2),
PARTITION p2 VALUES LESS THAN (3),
PARTITION p3 VALUES LESS THAN (4),
PARTITION p4 VALUES LESS THAN (5),
PARTITION p5 VALUES LESS THAN (6),
PARTITION max VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7),(8);
EXPLAIN SELECT * FROM t1 WHERE a <= 1;
id	count	task	operator info
Union_8	2.00	root	
├─TableReader_10	3333.33	root	data:TableScan_9
│ └─TableScan_9	3333.33	cop	table:t1, partition:p0, range:[-inf,1], keep order:false, stats:pseudo
└─TableReader_12	3333.33	root	data:TableScan_11
  └─TableScan_11	3333.33	cop	table:t1, partition:p1, range:[-inf,1], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE a < 7;
id	count	task	operator info
Union_13	49.00	root	
├─TableReader_15	3333.33	root	data:TableScan_14
│ └─TableScan_14	3333.33	cop	table:t1, partition:p0, range:[-inf,7), keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:TableScan_16
│ └─TableScan_16	3333.33	cop	table:t1, partition:p1, range:[-inf,7), keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:TableScan_18
│ └─TableScan_18	3333.33	cop	table:t1, partition:p2, range:[-inf,7), keep order:false, stats:pseudo
├─TableReader_21	3333.33	root	data:TableScan_20
│ └─TableScan_20	3333.33	cop	table:t1, partition:p3, range:[-inf,7), keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:TableScan_22
│ └─TableScan_22	3333.33	cop	table:t1, partition:p4, range:[-inf,7), keep order:false, stats:pseudo
├─TableReader_25	3333.33	root	data:TableScan_24
│ └─TableScan_24	3333.33	cop	table:t1, partition:p5, range:[-inf,7), keep order:false, stats:pseudo
└─TableReader_27	3333.33	root	data:TableScan_26
  └─TableScan_26	3333.33	cop	table:t1, partition:max, range:[-inf,7), keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE a <= 1;
id	count	task	operator info
Union_8	2.00	root	
├─TableReader_10	3333.33	root	data:TableScan_9
│ └─TableScan_9	3333.33	cop	table:t1, partition:p0, range:[-inf,1], keep order:false, stats:pseudo
└─TableReader_12	3333.33	root	data:TableScan_11
  └─TableScan_11	3333.33	cop	table:t1, partition:p1, range:[-inf,1], keep order:false, stats:pseudo
DROP TABLE t1;
#
# Bug#49742: Partition Pruning not working correctly for RANGE
#
CREATE TABLE t1 (a INT PRIMARY KEY)
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (1),
PARTITION p1 VALUES LESS THAN (2),
PARTITION p2 VALUES LESS THAN (3),
PARTITION p3 VALUES LESS THAN (4),
PARTITION p4 VALUES LESS THAN (5),
PARTITION p5 VALUES LESS THAN (6),
PARTITION max VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7),(8);
SELECT * FROM t1 WHERE a < 1 order by a;
a
-1
0
EXPLAIN SELECT * FROM t1 WHERE a < 1;
id	count	task	operator info
TableReader_7	3333.33	root	data:TableScan_6
└─TableScan_6	3333.33	cop	table:t1, partition:p0, range:[-inf,1), keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a < 2 order by a;
a
-1
0
1
EXPLAIN SELECT * FROM t1 WHERE a < 2;
id	count	task	operator info
Union_8	4.00	root	
├─TableReader_10	3333.33	root	data:TableScan_9
│ └─TableScan_9	3333.33	cop	table:t1, partition:p0, range:[-inf,2), keep order:false, stats:pseudo
└─TableReader_12	3333.33	root	data:TableScan_11
  └─TableScan_11	3333.33	cop	table:t1, partition:p1, range:[-inf,2), keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a < 3 order by a;
a
-1
0
1
2
EXPLAIN SELECT * FROM t1 WHERE a < 3;
id	count	task	operator info
Union_9	9.00	root	
├─TableReader_11	3333.33	root	data:TableScan_10
│ └─TableScan_10	3333.33	cop	table:t1, partition:p0, range:[-inf,3), keep order:false, stats:pseudo
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p1, range:[-inf,3), keep order:false, stats:pseudo
└─TableReader_15	3333.33	root	data:TableScan_14
  └─TableScan_14	3333.33	cop	table:t1, partition:p2, range:[-inf,3), keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a < 4 order by a;
a
-1
0
1
2
3
EXPLAIN SELECT * FROM t1 WHERE a < 4;
id	count	task	operator info
Union_10	16.00	root	
├─TableReader_12	3333.33	root	data:TableScan_11
│ └─TableScan_11	3333.33	cop	table:t1, partition:p0, range:[-inf,4), keep order:false, stats:pseudo
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p1, range:[-inf,4), keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p2, range:[-inf,4), keep order:false, stats:pseudo
└─TableReader_18	3333.33	root	data:TableScan_17
  └─TableScan_17	3333.33	cop	table:t1, partition:p3, range:[-inf,4), keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a < 5 order by a;
a
-1
0
1
2
3
4
EXPLAIN SELECT * FROM t1 WHERE a < 5;
id	count	task	operator info
Union_11	25.00	root	
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p0, range:[-inf,5), keep order:false, stats:pseudo
├─TableReader_15	3333.33	root	data:TableScan_14
│ └─TableScan_14	3333.33	cop	table:t1, partition:p1, range:[-inf,5), keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:TableScan_16
│ └─TableScan_16	3333.33	cop	table:t1, partition:p2, range:[-inf,5), keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:TableScan_18
│ └─TableScan_18	3333.33	cop	table:t1, partition:p3, range:[-inf,5), keep order:false, stats:pseudo
└─TableReader_21	3333.33	root	data:TableScan_20
  └─TableScan_20	3333.33	cop	table:t1, partition:p4, range:[-inf,5), keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a < 6 order by a;
a
-1
0
1
2
3
4
5
EXPLAIN SELECT * FROM t1 WHERE a < 6;
id	count	task	operator info
Union_12	36.00	root	
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p0, range:[-inf,6), keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p1, range:[-inf,6), keep order:false, stats:pseudo
├─TableReader_18	3333.33	root	data:TableScan_17
│ └─TableScan_17	3333.33	cop	table:t1, partition:p2, range:[-inf,6), keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:TableScan_19
│ └─TableScan_19	3333.33	cop	table:t1, partition:p3, range:[-inf,6), keep order:false, stats:pseudo
├─TableReader_22	3333.33	root	data:TableScan_21
│ └─TableScan_21	3333.33	cop	table:t1, partition:p4, range:[-inf,6), keep order:false, stats:pseudo
└─TableReader_24	3333.33	root	data:TableScan_23
  └─TableScan_23	3333.33	cop	table:t1, partition:p5, range:[-inf,6), keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a < 7 order by a;
a
-1
0
1
2
3
4
5
6
EXPLAIN SELECT * FROM t1 WHERE a < 7;
id	count	task	operator info
Union_13	49.00	root	
├─TableReader_15	3333.33	root	data:TableScan_14
│ └─TableScan_14	3333.33	cop	table:t1, partition:p0, range:[-inf,7), keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:TableScan_16
│ └─TableScan_16	3333.33	cop	table:t1, partition:p1, range:[-inf,7), keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:TableScan_18
│ └─TableScan_18	3333.33	cop	table:t1, partition:p2, range:[-inf,7), keep order:false, stats:pseudo
├─TableReader_21	3333.33	root	data:TableScan_20
│ └─TableScan_20	3333.33	cop	table:t1, partition:p3, range:[-inf,7), keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:TableScan_22
│ └─TableScan_22	3333.33	cop	table:t1, partition:p4, range:[-inf,7), keep order:false, stats:pseudo
├─TableReader_25	3333.33	root	data:TableScan_24
│ └─TableScan_24	3333.33	cop	table:t1, partition:p5, range:[-inf,7), keep order:false, stats:pseudo
└─TableReader_27	3333.33	root	data:TableScan_26
  └─TableScan_26	3333.33	cop	table:t1, partition:max, range:[-inf,7), keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a <= 1 order by a;
a
-1
0
1
EXPLAIN SELECT * FROM t1 WHERE a <= 1;
id	count	task	operator info
Union_8	2.00	root	
├─TableReader_10	3333.33	root	data:TableScan_9
│ └─TableScan_9	3333.33	cop	table:t1, partition:p0, range:[-inf,1], keep order:false, stats:pseudo
└─TableReader_12	3333.33	root	data:TableScan_11
  └─TableScan_11	3333.33	cop	table:t1, partition:p1, range:[-inf,1], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a <= 2 order by a;
a
-1
0
1
2
EXPLAIN SELECT * FROM t1 WHERE a <= 2;
id	count	task	operator info
Union_9	6.00	root	
├─TableReader_11	3333.33	root	data:TableScan_10
│ └─TableScan_10	3333.33	cop	table:t1, partition:p0, range:[-inf,2], keep order:false, stats:pseudo
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p1, range:[-inf,2], keep order:false, stats:pseudo
└─TableReader_15	3333.33	root	data:TableScan_14
  └─TableScan_14	3333.33	cop	table:t1, partition:p2, range:[-inf,2], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a <= 3 order by a;
a
-1
0
1
2
3
EXPLAIN SELECT * FROM t1 WHERE a <= 3;
id	count	task	operator info
Union_10	12.00	root	
├─TableReader_12	3333.33	root	data:TableScan_11
│ └─TableScan_11	3333.33	cop	table:t1, partition:p0, range:[-inf,3], keep order:false, stats:pseudo
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p1, range:[-inf,3], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p2, range:[-inf,3], keep order:false, stats:pseudo
└─TableReader_18	3333.33	root	data:TableScan_17
  └─TableScan_17	3333.33	cop	table:t1, partition:p3, range:[-inf,3], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a <= 4 order by a;
a
-1
0
1
2
3
4
EXPLAIN SELECT * FROM t1 WHERE a <= 4;
id	count	task	operator info
Union_11	20.00	root	
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p0, range:[-inf,4], keep order:false, stats:pseudo
├─TableReader_15	3333.33	root	data:TableScan_14
│ └─TableScan_14	3333.33	cop	table:t1, partition:p1, range:[-inf,4], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:TableScan_16
│ └─TableScan_16	3333.33	cop	table:t1, partition:p2, range:[-inf,4], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:TableScan_18
│ └─TableScan_18	3333.33	cop	table:t1, partition:p3, range:[-inf,4], keep order:false, stats:pseudo
└─TableReader_21	3333.33	root	data:TableScan_20
  └─TableScan_20	3333.33	cop	table:t1, partition:p4, range:[-inf,4], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a <= 5 order by a;
a
-1
0
1
2
3
4
5
EXPLAIN SELECT * FROM t1 WHERE a <= 5;
id	count	task	operator info
Union_12	30.00	root	
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p0, range:[-inf,5], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p1, range:[-inf,5], keep order:false, stats:pseudo
├─TableReader_18	3333.33	root	data:TableScan_17
│ └─TableScan_17	3333.33	cop	table:t1, partition:p2, range:[-inf,5], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:TableScan_19
│ └─TableScan_19	3333.33	cop	table:t1, partition:p3, range:[-inf,5], keep order:false, stats:pseudo
├─TableReader_22	3333.33	root	data:TableScan_21
│ └─TableScan_21	3333.33	cop	table:t1, partition:p4, range:[-inf,5], keep order:false, stats:pseudo
└─TableReader_24	3333.33	root	data:TableScan_23
  └─TableScan_23	3333.33	cop	table:t1, partition:p5, range:[-inf,5], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a <= 6 order by a;
a
-1
0
1
2
3
4
5
6
EXPLAIN SELECT * FROM t1 WHERE a <= 6;
id	count	task	operator info
Union_13	42.00	root	
├─TableReader_15	3333.33	root	data:TableScan_14
│ └─TableScan_14	3333.33	cop	table:t1, partition:p0, range:[-inf,6], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:TableScan_16
│ └─TableScan_16	3333.33	cop	table:t1, partition:p1, range:[-inf,6], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:TableScan_18
│ └─TableScan_18	3333.33	cop	table:t1, partition:p2, range:[-inf,6], keep order:false, stats:pseudo
├─TableReader_21	3333.33	root	data:TableScan_20
│ └─TableScan_20	3333.33	cop	table:t1, partition:p3, range:[-inf,6], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:TableScan_22
│ └─TableScan_22	3333.33	cop	table:t1, partition:p4, range:[-inf,6], keep order:false, stats:pseudo
├─TableReader_25	3333.33	root	data:TableScan_24
│ └─TableScan_24	3333.33	cop	table:t1, partition:p5, range:[-inf,6], keep order:false, stats:pseudo
└─TableReader_27	3333.33	root	data:TableScan_26
  └─TableScan_26	3333.33	cop	table:t1, partition:max, range:[-inf,6], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a <= 7 order by a;
a
-1
0
1
2
3
4
5
6
7
EXPLAIN SELECT * FROM t1 WHERE a <= 7;
id	count	task	operator info
Union_13	49.00	root	
├─TableReader_15	3333.33	root	data:TableScan_14
│ └─TableScan_14	3333.33	cop	table:t1, partition:p0, range:[-inf,7], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:TableScan_16
│ └─TableScan_16	3333.33	cop	table:t1, partition:p1, range:[-inf,7], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:TableScan_18
│ └─TableScan_18	3333.33	cop	table:t1, partition:p2, range:[-inf,7], keep order:false, stats:pseudo
├─TableReader_21	3333.33	root	data:TableScan_20
│ └─TableScan_20	3333.33	cop	table:t1, partition:p3, range:[-inf,7], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:TableScan_22
│ └─TableScan_22	3333.33	cop	table:t1, partition:p4, range:[-inf,7], keep order:false, stats:pseudo
├─TableReader_25	3333.33	root	data:TableScan_24
│ └─TableScan_24	3333.33	cop	table:t1, partition:p5, range:[-inf,7], keep order:false, stats:pseudo
└─TableReader_27	3333.33	root	data:TableScan_26
  └─TableScan_26	3333.33	cop	table:t1, partition:max, range:[-inf,7], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a = 1 order by a;
a
1
EXPLAIN SELECT * FROM t1 WHERE a = 1;
id	count	task	operator info
TableReader_7	1.00	root	data:TableScan_6
└─TableScan_6	1.00	cop	table:t1, partition:p1, range:[1,1], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a = 2 order by a;
a
2
EXPLAIN SELECT * FROM t1 WHERE a = 2;
id	count	task	operator info
TableReader_7	1.00	root	data:TableScan_6
└─TableScan_6	1.00	cop	table:t1, partition:p2, range:[2,2], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a = 3 order by a;
a
3
EXPLAIN SELECT * FROM t1 WHERE a = 3;
id	count	task	operator info
TableReader_7	1.00	root	data:TableScan_6
└─TableScan_6	1.00	cop	table:t1, partition:p3, range:[3,3], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a = 4 order by a;
a
4
EXPLAIN SELECT * FROM t1 WHERE a = 4;
id	count	task	operator info
TableReader_7	1.00	root	data:TableScan_6
└─TableScan_6	1.00	cop	table:t1, partition:p4, range:[4,4], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a = 5 order by a;
a
5
EXPLAIN SELECT * FROM t1 WHERE a = 5;
id	count	task	operator info
TableReader_7	1.00	root	data:TableScan_6
└─TableScan_6	1.00	cop	table:t1, partition:p5, range:[5,5], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a = 6 order by a;
a
6
EXPLAIN SELECT * FROM t1 WHERE a = 6;
id	count	task	operator info
TableReader_7	1.00	root	data:TableScan_6
└─TableScan_6	1.00	cop	table:t1, partition:max, range:[6,6], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a = 7 order by a;
a
7
EXPLAIN SELECT * FROM t1 WHERE a = 7;
id	count	task	operator info
TableReader_7	1.00	root	data:TableScan_6
└─TableScan_6	1.00	cop	table:t1, partition:max, range:[7,7], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a >= 1 order by a;
a
1
2
3
4
5
6
7
8
EXPLAIN SELECT * FROM t1 WHERE a >= 1;
id	count	task	operator info
Union_12	20000.00	root	
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p1, range:[1,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p2, range:[1,+inf], keep order:false, stats:pseudo
├─TableReader_18	3333.33	root	data:TableScan_17
│ └─TableScan_17	3333.33	cop	table:t1, partition:p3, range:[1,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:TableScan_19
│ └─TableScan_19	3333.33	cop	table:t1, partition:p4, range:[1,+inf], keep order:false, stats:pseudo
├─TableReader_22	3333.33	root	data:TableScan_21
│ └─TableScan_21	3333.33	cop	table:t1, partition:p5, range:[1,+inf], keep order:false, stats:pseudo
└─TableReader_24	3333.33	root	data:TableScan_23
  └─TableScan_23	3333.33	cop	table:t1, partition:max, range:[1,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a >= 2 order by a;
a
2
3
4
5
6
7
8
EXPLAIN SELECT * FROM t1 WHERE a >= 2;
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p2, range:[2,+inf], keep order:false, stats:pseudo
├─TableReader_15	3333.33	root	data:TableScan_14
│ └─TableScan_14	3333.33	cop	table:t1, partition:p3, range:[2,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:TableScan_16
│ └─TableScan_16	3333.33	cop	table:t1, partition:p4, range:[2,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:TableScan_18
│ └─TableScan_18	3333.33	cop	table:t1, partition:p5, range:[2,+inf], keep order:false, stats:pseudo
└─TableReader_21	3333.33	root	data:TableScan_20
  └─TableScan_20	3333.33	cop	table:t1, partition:max, range:[2,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a >= 3 order by a;
a
3
4
5
6
7
8
EXPLAIN SELECT * FROM t1 WHERE a >= 3;
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_12	3333.33	root	data:TableScan_11
│ └─TableScan_11	3333.33	cop	table:t1, partition:p3, range:[3,+inf], keep order:false, stats:pseudo
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p4, range:[3,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p5, range:[3,+inf], keep order:false, stats:pseudo
└─TableReader_18	3333.33	root	data:TableScan_17
  └─TableScan_17	3333.33	cop	table:t1, partition:max, range:[3,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a >= 4 order by a;
a
4
5
6
7
8
EXPLAIN SELECT * FROM t1 WHERE a >= 4;
id	count	task	operator info
Union_9	10000.00	root	
├─TableReader_11	3333.33	root	data:TableScan_10
│ └─TableScan_10	3333.33	cop	table:t1, partition:p4, range:[4,+inf], keep order:false, stats:pseudo
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p5, range:[4,+inf], keep order:false, stats:pseudo
└─TableReader_15	3333.33	root	data:TableScan_14
  └─TableScan_14	3333.33	cop	table:t1, partition:max, range:[4,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a >= 5 order by a;
a
5
6
7
8
EXPLAIN SELECT * FROM t1 WHERE a >= 5;
id	count	task	operator info
Union_8	6666.67	root	
├─TableReader_10	3333.33	root	data:TableScan_9
│ └─TableScan_9	3333.33	cop	table:t1, partition:p5, range:[5,+inf], keep order:false, stats:pseudo
└─TableReader_12	3333.33	root	data:TableScan_11
  └─TableScan_11	3333.33	cop	table:t1, partition:max, range:[5,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a >= 6 order by a;
a
6
7
8
EXPLAIN SELECT * FROM t1 WHERE a >= 6;
id	count	task	operator info
TableReader_7	3333.33	root	data:TableScan_6
└─TableScan_6	3333.33	cop	table:t1, partition:max, range:[6,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a >= 7 order by a;
a
7
8
EXPLAIN SELECT * FROM t1 WHERE a >= 7;
id	count	task	operator info
TableReader_7	3333.33	root	data:TableScan_6
└─TableScan_6	3333.33	cop	table:t1, partition:max, range:[7,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a > 1 order by a;
a
2
3
4
5
6
7
8
EXPLAIN SELECT * FROM t1 WHERE a > 1;
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p2, range:(1,+inf], keep order:false, stats:pseudo
├─TableReader_15	3333.33	root	data:TableScan_14
│ └─TableScan_14	3333.33	cop	table:t1, partition:p3, range:(1,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:TableScan_16
│ └─TableScan_16	3333.33	cop	table:t1, partition:p4, range:(1,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:TableScan_18
│ └─TableScan_18	3333.33	cop	table:t1, partition:p5, range:(1,+inf], keep order:false, stats:pseudo
└─TableReader_21	3333.33	root	data:TableScan_20
  └─TableScan_20	3333.33	cop	table:t1, partition:max, range:(1,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a > 2 order by a;
a
3
4
5
6
7
8
EXPLAIN SELECT * FROM t1 WHERE a > 2;
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_12	3333.33	root	data:TableScan_11
│ └─TableScan_11	3333.33	cop	table:t1, partition:p3, range:(2,+inf], keep order:false, stats:pseudo
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p4, range:(2,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p5, range:(2,+inf], keep order:false, stats:pseudo
└─TableReader_18	3333.33	root	data:TableScan_17
  └─TableScan_17	3333.33	cop	table:t1, partition:max, range:(2,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a > 3 order by a;
a
4
5
6
7
8
EXPLAIN SELECT * FROM t1 WHERE a > 3;
id	count	task	operator info
Union_9	10000.00	root	
├─TableReader_11	3333.33	root	data:TableScan_10
│ └─TableScan_10	3333.33	cop	table:t1, partition:p4, range:(3,+inf], keep order:false, stats:pseudo
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p5, range:(3,+inf], keep order:false, stats:pseudo
└─TableReader_15	3333.33	root	data:TableScan_14
  └─TableScan_14	3333.33	cop	table:t1, partition:max, range:(3,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a > 4 order by a;
a
5
6
7
8
EXPLAIN SELECT * FROM t1 WHERE a > 4;
id	count	task	operator info
Union_8	6666.67	root	
├─TableReader_10	3333.33	root	data:TableScan_9
│ └─TableScan_9	3333.33	cop	table:t1, partition:p5, range:(4,+inf], keep order:false, stats:pseudo
└─TableReader_12	3333.33	root	data:TableScan_11
  └─TableScan_11	3333.33	cop	table:t1, partition:max, range:(4,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a > 5 order by a;
a
6
7
8
EXPLAIN SELECT * FROM t1 WHERE a > 5;
id	count	task	operator info
TableReader_7	3333.33	root	data:TableScan_6
└─TableScan_6	3333.33	cop	table:t1, partition:max, range:(5,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a > 6 order by a;
a
7
8
EXPLAIN SELECT * FROM t1 WHERE a > 6;
id	count	task	operator info
TableReader_7	3333.33	root	data:TableScan_6
└─TableScan_6	3333.33	cop	table:t1, partition:max, range:(6,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a > 7 order by a;
a
8
EXPLAIN SELECT * FROM t1 WHERE a > 7;
id	count	task	operator info
TableReader_7	3333.33	root	data:TableScan_6
└─TableScan_6	3333.33	cop	table:t1, partition:max, range:(7,+inf], keep order:false, stats:pseudo
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY)
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (1),
PARTITION p1 VALUES LESS THAN (2),
PARTITION p2 VALUES LESS THAN (3),
PARTITION p3 VALUES LESS THAN (4),
PARTITION p4 VALUES LESS THAN (5),
PARTITION max VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7);
SELECT * FROM t1 WHERE a < 1 order by a;
a
-1
0
EXPLAIN SELECT * FROM t1 WHERE a < 1;
id	count	task	operator info
TableReader_7	3333.33	root	data:TableScan_6
└─TableScan_6	3333.33	cop	table:t1, partition:p0, range:[-inf,1), keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a < 2 order by a;
a
-1
0
1
EXPLAIN SELECT * FROM t1 WHERE a < 2;
id	count	task	operator info
Union_8	4.00	root	
├─TableReader_10	3333.33	root	data:TableScan_9
│ └─TableScan_9	3333.33	cop	table:t1, partition:p0, range:[-inf,2), keep order:false, stats:pseudo
└─TableReader_12	3333.33	root	data:TableScan_11
  └─TableScan_11	3333.33	cop	table:t1, partition:p1, range:[-inf,2), keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a < 3 order by a;
a
-1
0
1
2
EXPLAIN SELECT * FROM t1 WHERE a < 3;
id	count	task	operator info
Union_9	9.00	root	
├─TableReader_11	3333.33	root	data:TableScan_10
│ └─TableScan_10	3333.33	cop	table:t1, partition:p0, range:[-inf,3), keep order:false, stats:pseudo
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p1, range:[-inf,3), keep order:false, stats:pseudo
└─TableReader_15	3333.33	root	data:TableScan_14
  └─TableScan_14	3333.33	cop	table:t1, partition:p2, range:[-inf,3), keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a < 4 order by a;
a
-1
0
1
2
3
EXPLAIN SELECT * FROM t1 WHERE a < 4;
id	count	task	operator info
Union_10	16.00	root	
├─TableReader_12	3333.33	root	data:TableScan_11
│ └─TableScan_11	3333.33	cop	table:t1, partition:p0, range:[-inf,4), keep order:false, stats:pseudo
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p1, range:[-inf,4), keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p2, range:[-inf,4), keep order:false, stats:pseudo
└─TableReader_18	3333.33	root	data:TableScan_17
  └─TableScan_17	3333.33	cop	table:t1, partition:p3, range:[-inf,4), keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a < 5 order by a;
a
-1
0
1
2
3
4
EXPLAIN SELECT * FROM t1 WHERE a < 5;
id	count	task	operator info
Union_11	25.00	root	
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p0, range:[-inf,5), keep order:false, stats:pseudo
├─TableReader_15	3333.33	root	data:TableScan_14
│ └─TableScan_14	3333.33	cop	table:t1, partition:p1, range:[-inf,5), keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:TableScan_16
│ └─TableScan_16	3333.33	cop	table:t1, partition:p2, range:[-inf,5), keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:TableScan_18
│ └─TableScan_18	3333.33	cop	table:t1, partition:p3, range:[-inf,5), keep order:false, stats:pseudo
└─TableReader_21	3333.33	root	data:TableScan_20
  └─TableScan_20	3333.33	cop	table:t1, partition:p4, range:[-inf,5), keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a < 6 order by a;
a
-1
0
1
2
3
4
5
EXPLAIN SELECT * FROM t1 WHERE a < 6;
id	count	task	operator info
Union_12	36.00	root	
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p0, range:[-inf,6), keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p1, range:[-inf,6), keep order:false, stats:pseudo
├─TableReader_18	3333.33	root	data:TableScan_17
│ └─TableScan_17	3333.33	cop	table:t1, partition:p2, range:[-inf,6), keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:TableScan_19
│ └─TableScan_19	3333.33	cop	table:t1, partition:p3, range:[-inf,6), keep order:false, stats:pseudo
├─TableReader_22	3333.33	root	data:TableScan_21
│ └─TableScan_21	3333.33	cop	table:t1, partition:p4, range:[-inf,6), keep order:false, stats:pseudo
└─TableReader_24	3333.33	root	data:TableScan_23
  └─TableScan_23	3333.33	cop	table:t1, partition:max, range:[-inf,6), keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a <= 1 order by a;
a
-1
0
1
EXPLAIN SELECT * FROM t1 WHERE a <= 1;
id	count	task	operator info
Union_8	2.00	root	
├─TableReader_10	3333.33	root	data:TableScan_9
│ └─TableScan_9	3333.33	cop	table:t1, partition:p0, range:[-inf,1], keep order:false, stats:pseudo
└─TableReader_12	3333.33	root	data:TableScan_11
  └─TableScan_11	3333.33	cop	table:t1, partition:p1, range:[-inf,1], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a <= 2 order by a;
a
-1
0
1
2
EXPLAIN SELECT * FROM t1 WHERE a <= 2;
id	count	task	operator info
Union_9	6.00	root	
├─TableReader_11	3333.33	root	data:TableScan_10
│ └─TableScan_10	3333.33	cop	table:t1, partition:p0, range:[-inf,2], keep order:false, stats:pseudo
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p1, range:[-inf,2], keep order:false, stats:pseudo
└─TableReader_15	3333.33	root	data:TableScan_14
  └─TableScan_14	3333.33	cop	table:t1, partition:p2, range:[-inf,2], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a <= 3 order by a;
a
-1
0
1
2
3
EXPLAIN SELECT * FROM t1 WHERE a <= 3;
id	count	task	operator info
Union_10	12.00	root	
├─TableReader_12	3333.33	root	data:TableScan_11
│ └─TableScan_11	3333.33	cop	table:t1, partition:p0, range:[-inf,3], keep order:false, stats:pseudo
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p1, range:[-inf,3], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p2, range:[-inf,3], keep order:false, stats:pseudo
└─TableReader_18	3333.33	root	data:TableScan_17
  └─TableScan_17	3333.33	cop	table:t1, partition:p3, range:[-inf,3], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a <= 4 order by a;
a
-1
0
1
2
3
4
EXPLAIN SELECT * FROM t1 WHERE a <= 4;
id	count	task	operator info
Union_11	20.00	root	
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p0, range:[-inf,4], keep order:false, stats:pseudo
├─TableReader_15	3333.33	root	data:TableScan_14
│ └─TableScan_14	3333.33	cop	table:t1, partition:p1, range:[-inf,4], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:TableScan_16
│ └─TableScan_16	3333.33	cop	table:t1, partition:p2, range:[-inf,4], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:TableScan_18
│ └─TableScan_18	3333.33	cop	table:t1, partition:p3, range:[-inf,4], keep order:false, stats:pseudo
└─TableReader_21	3333.33	root	data:TableScan_20
  └─TableScan_20	3333.33	cop	table:t1, partition:p4, range:[-inf,4], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a <= 5 order by a;
a
-1
0
1
2
3
4
5
EXPLAIN SELECT * FROM t1 WHERE a <= 5;
id	count	task	operator info
Union_12	30.00	root	
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p0, range:[-inf,5], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p1, range:[-inf,5], keep order:false, stats:pseudo
├─TableReader_18	3333.33	root	data:TableScan_17
│ └─TableScan_17	3333.33	cop	table:t1, partition:p2, range:[-inf,5], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:TableScan_19
│ └─TableScan_19	3333.33	cop	table:t1, partition:p3, range:[-inf,5], keep order:false, stats:pseudo
├─TableReader_22	3333.33	root	data:TableScan_21
│ └─TableScan_21	3333.33	cop	table:t1, partition:p4, range:[-inf,5], keep order:false, stats:pseudo
└─TableReader_24	3333.33	root	data:TableScan_23
  └─TableScan_23	3333.33	cop	table:t1, partition:max, range:[-inf,5], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a <= 6 order by a;
a
-1
0
1
2
3
4
5
6
EXPLAIN SELECT * FROM t1 WHERE a <= 6;
id	count	task	operator info
Union_12	36.00	root	
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p0, range:[-inf,6], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p1, range:[-inf,6], keep order:false, stats:pseudo
├─TableReader_18	3333.33	root	data:TableScan_17
│ └─TableScan_17	3333.33	cop	table:t1, partition:p2, range:[-inf,6], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:TableScan_19
│ └─TableScan_19	3333.33	cop	table:t1, partition:p3, range:[-inf,6], keep order:false, stats:pseudo
├─TableReader_22	3333.33	root	data:TableScan_21
│ └─TableScan_21	3333.33	cop	table:t1, partition:p4, range:[-inf,6], keep order:false, stats:pseudo
└─TableReader_24	3333.33	root	data:TableScan_23
  └─TableScan_23	3333.33	cop	table:t1, partition:max, range:[-inf,6], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a = 1;
a
1
EXPLAIN SELECT * FROM t1 WHERE a = 1;
id	count	task	operator info
TableReader_7	1.00	root	data:TableScan_6
└─TableScan_6	1.00	cop	table:t1, partition:p1, range:[1,1], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a = 2;
a
2
EXPLAIN SELECT * FROM t1 WHERE a = 2;
id	count	task	operator info
TableReader_7	1.00	root	data:TableScan_6
└─TableScan_6	1.00	cop	table:t1, partition:p2, range:[2,2], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a = 3;
a
3
EXPLAIN SELECT * FROM t1 WHERE a = 3;
id	count	task	operator info
TableReader_7	1.00	root	data:TableScan_6
└─TableScan_6	1.00	cop	table:t1, partition:p3, range:[3,3], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a = 4;
a
4
EXPLAIN SELECT * FROM t1 WHERE a = 4;
id	count	task	operator info
TableReader_7	1.00	root	data:TableScan_6
└─TableScan_6	1.00	cop	table:t1, partition:p4, range:[4,4], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a = 5;
a
5
EXPLAIN SELECT * FROM t1 WHERE a = 5;
id	count	task	operator info
TableReader_7	1.00	root	data:TableScan_6
└─TableScan_6	1.00	cop	table:t1, partition:max, range:[5,5], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a = 6;
a
6
EXPLAIN SELECT * FROM t1 WHERE a = 6;
id	count	task	operator info
TableReader_7	1.00	root	data:TableScan_6
└─TableScan_6	1.00	cop	table:t1, partition:max, range:[6,6], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a >= 1 order by a;
a
1
2
3
4
5
6
7
EXPLAIN SELECT * FROM t1 WHERE a >= 1;
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p1, range:[1,+inf], keep order:false, stats:pseudo
├─TableReader_15	3333.33	root	data:TableScan_14
│ └─TableScan_14	3333.33	cop	table:t1, partition:p2, range:[1,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:TableScan_16
│ └─TableScan_16	3333.33	cop	table:t1, partition:p3, range:[1,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:TableScan_18
│ └─TableScan_18	3333.33	cop	table:t1, partition:p4, range:[1,+inf], keep order:false, stats:pseudo
└─TableReader_21	3333.33	root	data:TableScan_20
  └─TableScan_20	3333.33	cop	table:t1, partition:max, range:[1,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a >= 2 order by a;
a
2
3
4
5
6
7
EXPLAIN SELECT * FROM t1 WHERE a >= 2;
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_12	3333.33	root	data:TableScan_11
│ └─TableScan_11	3333.33	cop	table:t1, partition:p2, range:[2,+inf], keep order:false, stats:pseudo
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p3, range:[2,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p4, range:[2,+inf], keep order:false, stats:pseudo
└─TableReader_18	3333.33	root	data:TableScan_17
  └─TableScan_17	3333.33	cop	table:t1, partition:max, range:[2,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a >= 3 order by a;
a
3
4
5
6
7
EXPLAIN SELECT * FROM t1 WHERE a >= 3;
id	count	task	operator info
Union_9	10000.00	root	
├─TableReader_11	3333.33	root	data:TableScan_10
│ └─TableScan_10	3333.33	cop	table:t1, partition:p3, range:[3,+inf], keep order:false, stats:pseudo
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p4, range:[3,+inf], keep order:false, stats:pseudo
└─TableReader_15	3333.33	root	data:TableScan_14
  └─TableScan_14	3333.33	cop	table:t1, partition:max, range:[3,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a >= 4 order by a;
a
4
5
6
7
EXPLAIN SELECT * FROM t1 WHERE a >= 4;
id	count	task	operator info
Union_8	6666.67	root	
├─TableReader_10	3333.33	root	data:TableScan_9
│ └─TableScan_9	3333.33	cop	table:t1, partition:p4, range:[4,+inf], keep order:false, stats:pseudo
└─TableReader_12	3333.33	root	data:TableScan_11
  └─TableScan_11	3333.33	cop	table:t1, partition:max, range:[4,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a >= 5 order by a;
a
5
6
7
EXPLAIN SELECT * FROM t1 WHERE a >= 5;
id	count	task	operator info
TableReader_7	3333.33	root	data:TableScan_6
└─TableScan_6	3333.33	cop	table:t1, partition:max, range:[5,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a >= 6 order by a;
a
6
7
EXPLAIN SELECT * FROM t1 WHERE a >= 6;
id	count	task	operator info
TableReader_7	3333.33	root	data:TableScan_6
└─TableScan_6	3333.33	cop	table:t1, partition:max, range:[6,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a > 1 order by a;
a
2
3
4
5
6
7
EXPLAIN SELECT * FROM t1 WHERE a > 1;
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_12	3333.33	root	data:TableScan_11
│ └─TableScan_11	3333.33	cop	table:t1, partition:p2, range:(1,+inf], keep order:false, stats:pseudo
├─TableReader_14	3333.33	root	data:TableScan_13
│ └─TableScan_13	3333.33	cop	table:t1, partition:p3, range:(1,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:TableScan_15
│ └─TableScan_15	3333.33	cop	table:t1, partition:p4, range:(1,+inf], keep order:false, stats:pseudo
└─TableReader_18	3333.33	root	data:TableScan_17
  └─TableScan_17	3333.33	cop	table:t1, partition:max, range:(1,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a > 2 order by a;
a
3
4
5
6
7
EXPLAIN SELECT * FROM t1 WHERE a > 2;
id	count	task	operator info
Union_9	10000.00	root	
├─TableReader_11	3333.33	root	data:TableScan_10
│ └─TableScan_10	3333.33	cop	table:t1, partition:p3, range:(2,+inf], keep order:false, stats:pseudo
├─TableReader_13	3333.33	root	data:TableScan_12
│ └─TableScan_12	3333.33	cop	table:t1, partition:p4, range:(2,+inf], keep order:false, stats:pseudo
└─TableReader_15	3333.33	root	data:TableScan_14
  └─TableScan_14	3333.33	cop	table:t1, partition:max, range:(2,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a > 3 order by a;
a
4
5
6
7
EXPLAIN SELECT * FROM t1 WHERE a > 3;
id	count	task	operator info
Union_8	6666.67	root	
├─TableReader_10	3333.33	root	data:TableScan_9
│ └─TableScan_9	3333.33	cop	table:t1, partition:p4, range:(3,+inf], keep order:false, stats:pseudo
└─TableReader_12	3333.33	root	data:TableScan_11
  └─TableScan_11	3333.33	cop	table:t1, partition:max, range:(3,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a > 4 order by a;
a
5
6
7
EXPLAIN SELECT * FROM t1 WHERE a > 4;
id	count	task	operator info
TableReader_7	3333.33	root	data:TableScan_6
└─TableScan_6	3333.33	cop	table:t1, partition:max, range:(4,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a > 5 order by a;
a
6
7
EXPLAIN SELECT * FROM t1 WHERE a > 5;
id	count	task	operator info
TableReader_7	3333.33	root	data:TableScan_6
└─TableScan_6	3333.33	cop	table:t1, partition:max, range:(5,+inf], keep order:false, stats:pseudo
SELECT * FROM t1 WHERE a > 6 order by a;
a
7
EXPLAIN SELECT * FROM t1 WHERE a > 6;
id	count	task	operator info
TableReader_7	3333.33	root	data:TableScan_6
└─TableScan_6	3333.33	cop	table:t1, partition:max, range:(6,+inf], keep order:false, stats:pseudo
DROP TABLE t1;
# test of RANGE and index
CREATE TABLE t1 (a DATE, KEY(a))
PARTITION BY RANGE (TO_DAYS(a))
(PARTITION `pNULL` VALUES LESS THAN (0),
PARTITION `p0001-01-01` VALUES LESS THAN (366 + 1),
PARTITION `p1001-01-01` VALUES LESS THAN (TO_DAYS('1001-01-01') + 1),
PARTITION `p2001-01-01` VALUES LESS THAN (TO_DAYS('2001-01-01') + 1));
SET SQL_MODE = '';
INSERT INTO t1 VALUES ('0000-00-00'), ('0000-01-02'), ('0001-01-01'),
('1001-00-00'), ('1001-01-01'), ('1002-00-00'), ('2001-01-01');
# test without index
ALTER TABLE t1 DROP KEY a;
DROP TABLE t1;
# Test with DATETIME column NOT NULL
CREATE TABLE t1 (
a int(10) unsigned NOT NULL,
b DATETIME NOT NULL,
PRIMARY KEY (a, b)
) PARTITION BY RANGE (TO_DAYS(b))
(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
PARTITION p20090405 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'),
(1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-02 23:59:59'),
(1, '2009-04-03'), (2, '2009-04-03'), (1, '2009-04-04'), (2, '2009-04-04'),
(1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07');
EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:00)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-02 23:59:59)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00';
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:00.000000)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59';
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59';
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59';
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-02 23:59:59.000000)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59';
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59';
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03';
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:00.000000)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:01)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-02 23:59:58)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
DROP TABLE t1;
# Test with DATE column NOT NULL
CREATE TABLE t1 (
a int(10) unsigned NOT NULL,
b DATE NOT NULL,
PRIMARY KEY (a, b)
) PARTITION BY RANGE (TO_DAYS(b))
(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
PARTITION p20090405 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'),
(1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-03'), (2, '2009-04-03'),
(1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'),
(1, '2009-04-07');
EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:00)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
TableReader_8	0.00	root	data:Selection_7
└─Selection_7	0.00	cop	eq(test.t1.b, 2009-04-02 23:59:59)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00';
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:00.000000)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59';
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59';
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59';
id	count	task	operator info
TableReader_8	0.00	root	data:Selection_7
└─Selection_7	0.00	cop	eq(test.t1.b, 2009-04-02 23:59:59.000000)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59';
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59';
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03';
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:00.000000)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
TableReader_8	0.00	root	data:Selection_7
└─Selection_7	0.00	cop	eq(test.t1.b, 2009-04-03 00:00:01)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
TableReader_8	0.00	root	data:Selection_7
└─Selection_7	0.00	cop	eq(test.t1.b, 2009-04-02 23:59:58)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
DROP TABLE t1;
# Test with DATETIME column NULL
CREATE TABLE t1 (
a int(10) unsigned NOT NULL,
b DATETIME NULL
) PARTITION BY RANGE (TO_DAYS(b))
(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
PARTITION p20090405 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'),
(1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-02 23:59:59'),
(1, '2009-04-03'), (2, '2009-04-03'), (1, '2009-04-04'), (2, '2009-04-04'),
(1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07');
EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:00)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-02 23:59:59)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00';
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:00.000000)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59';
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59';
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59';
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-02 23:59:59.000000)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59';
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59';
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03';
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:00.000000)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:01)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-02 23:59:58)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
DROP TABLE t1;
# Test with DATE column NULL
CREATE TABLE t1 (
a int(10) unsigned NOT NULL,
b DATE NULL
) PARTITION BY RANGE (TO_DAYS(b))
(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
PARTITION p20090405 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'),
(1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-03'), (2, '2009-04-03'),
(1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'),
(1, '2009-04-07');
EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:00)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
TableReader_8	0.00	root	data:Selection_7
└─Selection_7	0.00	cop	eq(test.t1.b, 2009-04-02 23:59:59)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE);
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00';
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:00.000000)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59';
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59';
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59';
id	count	task	operator info
TableReader_8	0.00	root	data:Selection_7
└─Selection_7	0.00	cop	eq(test.t1.b, 2009-04-02 23:59:59.000000)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59';
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59';
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:59.000000)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b < '2009-04-03';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b <= '2009-04-03';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b = '2009-04-03';
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.b, 2009-04-03 00:00:00.000000)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b >= '2009-04-03';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1 WHERE b > '2009-04-03';
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:00.000000)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	le(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_16	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
TableReader_8	0.00	root	data:Selection_7
└─Selection_7	0.00	cop	eq(test.t1.b, 2009-04-03 00:00:01)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME);
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t1.b, 2009-04-03 00:00:01)
    └─TableScan_20	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_12	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
TableReader_8	0.00	root	data:Selection_7
└─Selection_7	0.00	cop	eq(test.t1.b, 2009-04-02 23:59:58)
  └─TableScan_6	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
EXPLAIN SELECT * FROM t1
WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME);
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	gt(test.t1.b, 2009-04-02 23:59:58)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
DROP TABLE t1;
# For better code coverage of the patch
CREATE TABLE t1 (
a int(10) unsigned NOT NULL,
b DATE
) PARTITION BY RANGE ( TO_DAYS(b) )
(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
PARTITION p20090405 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, '2009-01-01'), (2, NULL);
# test with an invalid date, which lead to item->null_value is set.
EXPLAIN SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME);
id	count	task	operator info
Union_11	0.00	root	
├─TableReader_14	0.00	root	data:Selection_13
│ └─Selection_13	0.00	cop	lt(test.t1.b, NULL)
│   └─TableScan_12	10000.00	cop	table:t1, partition:p20090401, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	0.00	root	data:Selection_16
│ └─Selection_16	0.00	cop	lt(test.t1.b, NULL)
│   └─TableScan_15	10000.00	cop	table:t1, partition:p20090402, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	0.00	root	data:Selection_19
│ └─Selection_19	0.00	cop	lt(test.t1.b, NULL)
│   └─TableScan_18	10000.00	cop	table:t1, partition:p20090403, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	0.00	root	data:Selection_22
│ └─Selection_22	0.00	cop	lt(test.t1.b, NULL)
│   └─TableScan_21	10000.00	cop	table:t1, partition:p20090404, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	0.00	root	data:Selection_25
  └─Selection_25	0.00	cop	lt(test.t1.b, NULL)
    └─TableScan_24	10000.00	cop	table:t1, partition:p20090405, range:[-inf,+inf], keep order:false, stats:pseudo
DROP TABLE t1;
CREATE TABLE t1
(a INT NOT NULL AUTO_INCREMENT,
b DATETIME,
PRIMARY KEY (a,b),
KEY (b))
PARTITION BY RANGE (to_days(b))
(PARTITION p0 VALUES LESS THAN (733681) COMMENT = 'LESS THAN 2008-10-01',
PARTITION p1 VALUES LESS THAN (733712) COMMENT = 'LESS THAN 2008-11-01',
PARTITION pX VALUES LESS THAN MAXVALUE);
SELECT a,b FROM t1 WHERE b >= '2008-12-01' AND b < '2009-12-00';
a	b
DROP TABLE t1;
create table t3 (
a int
)
partition by range (a*1) (
partition p0 values less than (10),
partition p1 values less than (20)
);
insert into t3 values (5),(15);
explain select * from t3 where a=11;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t3.a, 11)
  └─TableScan_6	10000.00	cop	table:t3, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t3 where a=10;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t3.a, 10)
  └─TableScan_6	10000.00	cop	table:t3, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t3 where a=20;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
explain select * from t3 where a=30;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
create table t7 (a int not null) partition by RANGE(a) (
partition p10 values less than (10),
partition p30 values less than (30),
partition p50 values less than (50),
partition p70 values less than (70),
partition p90 values less than (90)
);
insert into t7 values (10),(30),(50);
explain select * from t7 where a < 5;
id	count	task	operator info
TableReader_8	3323.33	root	data:Selection_7
└─Selection_7	3323.33	cop	lt(test.t7.a, 5)
  └─TableScan_6	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a < 9;
id	count	task	operator info
TableReader_8	3323.33	root	data:Selection_7
└─Selection_7	3323.33	cop	lt(test.t7.a, 9)
  └─TableScan_6	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a <= 9;
id	count	task	operator info
TableReader_8	3323.33	root	data:Selection_7
└─Selection_7	3323.33	cop	le(test.t7.a, 9)
  └─TableScan_6	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a = 9;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t7.a, 9)
  └─TableScan_6	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a >= 9;
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t7.a, 9)
│   └─TableScan_12	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t7.a, 9)
│   └─TableScan_15	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t7.a, 9)
│   └─TableScan_18	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t7.a, 9)
│   └─TableScan_21	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t7.a, 9)
    └─TableScan_24	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a > 9;
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t7.a, 9)
│   └─TableScan_11	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t7.a, 9)
│   └─TableScan_14	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t7.a, 9)
│   └─TableScan_17	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t7.a, 9)
    └─TableScan_20	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a < 10;
id	count	task	operator info
TableReader_8	3323.33	root	data:Selection_7
└─Selection_7	3323.33	cop	lt(test.t7.a, 10)
  └─TableScan_6	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a <= 10;
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t7.a, 10)
│   └─TableScan_9	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t7.a, 10)
    └─TableScan_12	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a = 10;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t7.a, 10)
  └─TableScan_6	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a >= 10;
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t7.a, 10)
│   └─TableScan_11	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t7.a, 10)
│   └─TableScan_14	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t7.a, 10)
│   └─TableScan_17	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t7.a, 10)
    └─TableScan_20	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a > 10;
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t7.a, 10)
│   └─TableScan_11	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t7.a, 10)
│   └─TableScan_14	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t7.a, 10)
│   └─TableScan_17	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t7.a, 10)
    └─TableScan_20	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a < 89;
id	count	task	operator info
Union_11	16616.67	root	
├─TableReader_14	3323.33	root	data:Selection_13
│ └─Selection_13	3323.33	cop	lt(test.t7.a, 89)
│   └─TableScan_12	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3323.33	root	data:Selection_16
│ └─Selection_16	3323.33	cop	lt(test.t7.a, 89)
│   └─TableScan_15	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3323.33	root	data:Selection_19
│ └─Selection_19	3323.33	cop	lt(test.t7.a, 89)
│   └─TableScan_18	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3323.33	root	data:Selection_22
│ └─Selection_22	3323.33	cop	lt(test.t7.a, 89)
│   └─TableScan_21	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3323.33	root	data:Selection_25
  └─Selection_25	3323.33	cop	lt(test.t7.a, 89)
    └─TableScan_24	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a <= 89;
id	count	task	operator info
Union_11	16616.67	root	
├─TableReader_14	3323.33	root	data:Selection_13
│ └─Selection_13	3323.33	cop	le(test.t7.a, 89)
│   └─TableScan_12	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3323.33	root	data:Selection_16
│ └─Selection_16	3323.33	cop	le(test.t7.a, 89)
│   └─TableScan_15	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3323.33	root	data:Selection_19
│ └─Selection_19	3323.33	cop	le(test.t7.a, 89)
│   └─TableScan_18	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3323.33	root	data:Selection_22
│ └─Selection_22	3323.33	cop	le(test.t7.a, 89)
│   └─TableScan_21	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3323.33	root	data:Selection_25
  └─Selection_25	3323.33	cop	le(test.t7.a, 89)
    └─TableScan_24	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a = 89;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t7.a, 89)
  └─TableScan_6	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a > 89;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
explain select * from t7 where a >= 89;
id	count	task	operator info
TableReader_8	3333.33	root	data:Selection_7
└─Selection_7	3333.33	cop	ge(test.t7.a, 89)
  └─TableScan_6	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a < 90;
id	count	task	operator info
Union_11	16616.67	root	
├─TableReader_14	3323.33	root	data:Selection_13
│ └─Selection_13	3323.33	cop	lt(test.t7.a, 90)
│   └─TableScan_12	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3323.33	root	data:Selection_16
│ └─Selection_16	3323.33	cop	lt(test.t7.a, 90)
│   └─TableScan_15	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3323.33	root	data:Selection_19
│ └─Selection_19	3323.33	cop	lt(test.t7.a, 90)
│   └─TableScan_18	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3323.33	root	data:Selection_22
│ └─Selection_22	3323.33	cop	lt(test.t7.a, 90)
│   └─TableScan_21	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3323.33	root	data:Selection_25
  └─Selection_25	3323.33	cop	lt(test.t7.a, 90)
    └─TableScan_24	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a <= 90;
id	count	task	operator info
Union_11	16616.67	root	
├─TableReader_14	3323.33	root	data:Selection_13
│ └─Selection_13	3323.33	cop	le(test.t7.a, 90)
│   └─TableScan_12	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3323.33	root	data:Selection_16
│ └─Selection_16	3323.33	cop	le(test.t7.a, 90)
│   └─TableScan_15	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3323.33	root	data:Selection_19
│ └─Selection_19	3323.33	cop	le(test.t7.a, 90)
│   └─TableScan_18	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3323.33	root	data:Selection_22
│ └─Selection_22	3323.33	cop	le(test.t7.a, 90)
│   └─TableScan_21	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3323.33	root	data:Selection_25
  └─Selection_25	3323.33	cop	le(test.t7.a, 90)
    └─TableScan_24	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a = 90;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
explain select * from t7 where a > 90;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
explain select * from t7 where a >= 90;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
explain select * from t7 where a > 91;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
explain select * from t7 where a > 11 and a < 29;
id	count	task	operator info
TableReader_8	250.00	root	data:Selection_7
└─Selection_7	250.00	cop	gt(test.t7.a, 11), lt(test.t7.a, 29)
  └─TableScan_6	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
drop table t7;
create table t7 (a int unsigned not null) partition by RANGE(a) (
partition p10 values less than (10),
partition p30 values less than (30),
partition p50 values less than (50),
partition p70 values less than (70),
partition p90 values less than (90)
);
insert into t7 values (10),(30),(50);
explain select * from t7 where a < 5;
id	count	task	operator info
TableReader_8	3323.33	root	data:Selection_7
└─Selection_7	3323.33	cop	lt(test.t7.a, 5)
  └─TableScan_6	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a < 9;
id	count	task	operator info
TableReader_8	3323.33	root	data:Selection_7
└─Selection_7	3323.33	cop	lt(test.t7.a, 9)
  └─TableScan_6	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a <= 9;
id	count	task	operator info
TableReader_8	3323.33	root	data:Selection_7
└─Selection_7	3323.33	cop	le(test.t7.a, 9)
  └─TableScan_6	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a = 9;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t7.a, 9)
  └─TableScan_6	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a >= 9;
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	ge(test.t7.a, 9)
│   └─TableScan_12	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3333.33	root	data:Selection_16
│ └─Selection_16	3333.33	cop	ge(test.t7.a, 9)
│   └─TableScan_15	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	ge(test.t7.a, 9)
│   └─TableScan_18	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3333.33	root	data:Selection_22
│ └─Selection_22	3333.33	cop	ge(test.t7.a, 9)
│   └─TableScan_21	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3333.33	root	data:Selection_25
  └─Selection_25	3333.33	cop	ge(test.t7.a, 9)
    └─TableScan_24	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a > 9;
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t7.a, 9)
│   └─TableScan_11	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t7.a, 9)
│   └─TableScan_14	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t7.a, 9)
│   └─TableScan_17	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t7.a, 9)
    └─TableScan_20	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a < 10;
id	count	task	operator info
TableReader_8	3323.33	root	data:Selection_7
└─Selection_7	3323.33	cop	lt(test.t7.a, 10)
  └─TableScan_6	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a <= 10;
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t7.a, 10)
│   └─TableScan_9	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t7.a, 10)
    └─TableScan_12	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a = 10;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t7.a, 10)
  └─TableScan_6	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a >= 10;
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	ge(test.t7.a, 10)
│   └─TableScan_11	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	ge(test.t7.a, 10)
│   └─TableScan_14	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	ge(test.t7.a, 10)
│   └─TableScan_17	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	ge(test.t7.a, 10)
    └─TableScan_20	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a > 10;
id	count	task	operator info
Union_10	13333.33	root	
├─TableReader_13	3333.33	root	data:Selection_12
│ └─Selection_12	3333.33	cop	gt(test.t7.a, 10)
│   └─TableScan_11	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	3333.33	root	data:Selection_15
│ └─Selection_15	3333.33	cop	gt(test.t7.a, 10)
│   └─TableScan_14	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	3333.33	root	data:Selection_18
│ └─Selection_18	3333.33	cop	gt(test.t7.a, 10)
│   └─TableScan_17	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	3333.33	root	data:Selection_21
  └─Selection_21	3333.33	cop	gt(test.t7.a, 10)
    └─TableScan_20	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a < 89;
id	count	task	operator info
Union_11	16616.67	root	
├─TableReader_14	3323.33	root	data:Selection_13
│ └─Selection_13	3323.33	cop	lt(test.t7.a, 89)
│   └─TableScan_12	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3323.33	root	data:Selection_16
│ └─Selection_16	3323.33	cop	lt(test.t7.a, 89)
│   └─TableScan_15	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3323.33	root	data:Selection_19
│ └─Selection_19	3323.33	cop	lt(test.t7.a, 89)
│   └─TableScan_18	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3323.33	root	data:Selection_22
│ └─Selection_22	3323.33	cop	lt(test.t7.a, 89)
│   └─TableScan_21	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3323.33	root	data:Selection_25
  └─Selection_25	3323.33	cop	lt(test.t7.a, 89)
    └─TableScan_24	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a <= 89;
id	count	task	operator info
Union_11	16616.67	root	
├─TableReader_14	3323.33	root	data:Selection_13
│ └─Selection_13	3323.33	cop	le(test.t7.a, 89)
│   └─TableScan_12	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3323.33	root	data:Selection_16
│ └─Selection_16	3323.33	cop	le(test.t7.a, 89)
│   └─TableScan_15	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3323.33	root	data:Selection_19
│ └─Selection_19	3323.33	cop	le(test.t7.a, 89)
│   └─TableScan_18	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3323.33	root	data:Selection_22
│ └─Selection_22	3323.33	cop	le(test.t7.a, 89)
│   └─TableScan_21	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3323.33	root	data:Selection_25
  └─Selection_25	3323.33	cop	le(test.t7.a, 89)
    └─TableScan_24	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a = 89;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t7.a, 89)
  └─TableScan_6	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a > 89;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
explain select * from t7 where a >= 89;
id	count	task	operator info
TableReader_8	3333.33	root	data:Selection_7
└─Selection_7	3333.33	cop	ge(test.t7.a, 89)
  └─TableScan_6	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a < 90;
id	count	task	operator info
Union_11	16616.67	root	
├─TableReader_14	3323.33	root	data:Selection_13
│ └─Selection_13	3323.33	cop	lt(test.t7.a, 90)
│   └─TableScan_12	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3323.33	root	data:Selection_16
│ └─Selection_16	3323.33	cop	lt(test.t7.a, 90)
│   └─TableScan_15	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3323.33	root	data:Selection_19
│ └─Selection_19	3323.33	cop	lt(test.t7.a, 90)
│   └─TableScan_18	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3323.33	root	data:Selection_22
│ └─Selection_22	3323.33	cop	lt(test.t7.a, 90)
│   └─TableScan_21	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3323.33	root	data:Selection_25
  └─Selection_25	3323.33	cop	lt(test.t7.a, 90)
    └─TableScan_24	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a <= 90;
id	count	task	operator info
Union_11	16616.67	root	
├─TableReader_14	3323.33	root	data:Selection_13
│ └─Selection_13	3323.33	cop	le(test.t7.a, 90)
│   └─TableScan_12	10000.00	cop	table:t7, partition:p10, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	3323.33	root	data:Selection_16
│ └─Selection_16	3323.33	cop	le(test.t7.a, 90)
│   └─TableScan_15	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3323.33	root	data:Selection_19
│ └─Selection_19	3323.33	cop	le(test.t7.a, 90)
│   └─TableScan_18	10000.00	cop	table:t7, partition:p50, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	3323.33	root	data:Selection_22
│ └─Selection_22	3323.33	cop	le(test.t7.a, 90)
│   └─TableScan_21	10000.00	cop	table:t7, partition:p70, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	3323.33	root	data:Selection_25
  └─Selection_25	3323.33	cop	le(test.t7.a, 90)
    └─TableScan_24	10000.00	cop	table:t7, partition:p90, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t7 where a = 90;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
explain select * from t7 where a > 90;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
explain select * from t7 where a >= 90;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
explain select * from t7 where a > 91;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
explain select * from t7 where a > 11 and a < 29;
id	count	task	operator info
TableReader_8	250.00	root	data:Selection_7
└─Selection_7	250.00	cop	gt(test.t7.a, 11), lt(test.t7.a, 29)
  └─TableScan_6	10000.00	cop	table:t7, partition:p30, range:[-inf,+inf], keep order:false, stats:pseudo
create table t8 (a date not null) partition by RANGE(YEAR(a)) (
partition p0 values less than (1980),
partition p1 values less than (1990),
partition p2 values less than (2000)
);
insert into t8 values ('1985-05-05'),('1995-05-05');
explain select * from t8 where a < '1980-02-02';
id	count	task	operator info
Union_9	9970.00	root	
├─TableReader_12	3323.33	root	data:Selection_11
│ └─Selection_11	3323.33	cop	lt(test.t8.a, 1980-02-02 00:00:00.000000)
│   └─TableScan_10	10000.00	cop	table:t8, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	3323.33	root	data:Selection_14
│ └─Selection_14	3323.33	cop	lt(test.t8.a, 1980-02-02 00:00:00.000000)
│   └─TableScan_13	10000.00	cop	table:t8, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	3323.33	root	data:Selection_17
  └─Selection_17	3323.33	cop	lt(test.t8.a, 1980-02-02 00:00:00.000000)
    └─TableScan_16	10000.00	cop	table:t8, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
create table t9 (a date not null) partition by RANGE(TO_DAYS(a)) (
partition p0 values less than (732299), -- 2004-12-19
partition p1 values less than (732468), -- 2005-06-06
partition p2 values less than (732664)  -- 2005-12-19
);
insert into t9 values ('2005-05-05'), ('2005-04-04');
explain select * from t9 where a <  '2004-12-19';
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t9.a, 2004-12-19 00:00:00.000000)
│   └─TableScan_9	10000.00	cop	table:t9, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t9.a, 2004-12-19 00:00:00.000000)
    └─TableScan_12	10000.00	cop	table:t9, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t9 where a <= '2004-12-19';
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	le(test.t9.a, 2004-12-19 00:00:00.000000)
│   └─TableScan_9	10000.00	cop	table:t9, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	le(test.t9.a, 2004-12-19 00:00:00.000000)
    └─TableScan_12	10000.00	cop	table:t9, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
drop table t7,t8,t9;
create table t1 (
a1 int not null
)
partition by range (a1) (
partition p0 values less than (3),
partition p1 values less than (6),
partition p2 values less than (9)
);
insert into t1 values (1),(2),(3);
explain select * from t1 where a1 > 3;
id	count	task	operator info
Union_8	6666.67	root	
├─TableReader_11	3333.33	root	data:Selection_10
│ └─Selection_10	3333.33	cop	gt(test.t1.a1, 3)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3333.33	root	data:Selection_13
  └─Selection_13	3333.33	cop	gt(test.t1.a1, 3)
    └─TableScan_12	10000.00	cop	table:t1, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t1 where a1 >= 3;
id	count	task	operator info
Union_8	6666.67	root	
├─TableReader_11	3333.33	root	data:Selection_10
│ └─Selection_10	3333.33	cop	ge(test.t1.a1, 3)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3333.33	root	data:Selection_13
  └─Selection_13	3333.33	cop	ge(test.t1.a1, 3)
    └─TableScan_12	10000.00	cop	table:t1, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t1 where a1 < 3 and a1 > 3;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
drop table t1;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
CREATE TABLE `t2` (
`a` int(11) default NULL,
KEY `a` (`a`)
) ;
insert into t2 select A.a + 10*(B.a + 10* C.a) from t1 A, t1 B, t1 C ;
insert into t1 select a from t2;
drop table t2;
CREATE TABLE `t2` (
`a` int(11) default NULL,
`b` int(11) default NULL
)
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (200),
PARTITION p1 VALUES LESS THAN (400),
PARTITION p2 VALUES LESS THAN (600),
PARTITION p3 VALUES LESS THAN (800),
PARTITION p4 VALUES LESS THAN (1001));
insert into t2 select a,1 from t1 where a < 200;
insert into t2 select a,2 from t1 where a >= 200 and a < 400;
insert into t2 select a,3 from t1 where a >= 400 and a < 600;
insert into t2 select a,4 from t1 where a >= 600 and a < 800;
insert into t2 select a,5 from t1 where a >= 800 and a < 1001;
explain select * from t2;
id	count	task	operator info
Union_10	50000.00	root	
├─TableReader_12	10000.00	root	data:TableScan_11
│ └─TableScan_11	10000.00	cop	table:t2, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_14	10000.00	root	data:TableScan_13
│ └─TableScan_13	10000.00	cop	table:t2, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	10000.00	root	data:TableScan_15
│ └─TableScan_15	10000.00	cop	table:t2, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_18	10000.00	root	data:TableScan_17
│ └─TableScan_17	10000.00	cop	table:t2, partition:p3, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_20	10000.00	root	data:TableScan_19
  └─TableScan_19	10000.00	cop	table:t2, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where a < 801 and a > 200;
id	count	task	operator info
Union_10	1000.00	root	
├─TableReader_13	250.00	root	data:Selection_12
│ └─Selection_12	250.00	cop	gt(test.t2.a, 200), lt(test.t2.a, 801)
│   └─TableScan_11	10000.00	cop	table:t2, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	250.00	root	data:Selection_15
│ └─Selection_15	250.00	cop	gt(test.t2.a, 200), lt(test.t2.a, 801)
│   └─TableScan_14	10000.00	cop	table:t2, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	250.00	root	data:Selection_18
│ └─Selection_18	250.00	cop	gt(test.t2.a, 200), lt(test.t2.a, 801)
│   └─TableScan_17	10000.00	cop	table:t2, partition:p3, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	250.00	root	data:Selection_21
  └─Selection_21	250.00	cop	gt(test.t2.a, 200), lt(test.t2.a, 801)
    └─TableScan_20	10000.00	cop	table:t2, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where a < 801 and a > 800;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
explain select * from t2 where a > 600;
id	count	task	operator info
Union_8	6666.67	root	
├─TableReader_11	3333.33	root	data:Selection_10
│ └─Selection_10	3333.33	cop	gt(test.t2.a, 600)
│   └─TableScan_9	10000.00	cop	table:t2, partition:p3, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3333.33	root	data:Selection_13
  └─Selection_13	3333.33	cop	gt(test.t2.a, 600)
    └─TableScan_12	10000.00	cop	table:t2, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where a > 600 and b = 1;
id	count	task	operator info
Union_8	6.67	root	
├─TableReader_11	3.33	root	data:Selection_10
│ └─Selection_10	3.33	cop	eq(test.t2.b, 1), gt(test.t2.a, 600)
│   └─TableScan_9	10000.00	cop	table:t2, partition:p3, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3.33	root	data:Selection_13
  └─Selection_13	3.33	cop	eq(test.t2.b, 1), gt(test.t2.a, 600)
    └─TableScan_12	10000.00	cop	table:t2, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where a > 600 and b = 4;
id	count	task	operator info
Union_8	6.67	root	
├─TableReader_11	3.33	root	data:Selection_10
│ └─Selection_10	3.33	cop	eq(test.t2.b, 4), gt(test.t2.a, 600)
│   └─TableScan_9	10000.00	cop	table:t2, partition:p3, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3.33	root	data:Selection_13
  └─Selection_13	3.33	cop	eq(test.t2.b, 4), gt(test.t2.a, 600)
    └─TableScan_12	10000.00	cop	table:t2, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where a > 600 and b = 5;
id	count	task	operator info
Union_8	6.67	root	
├─TableReader_11	3.33	root	data:Selection_10
│ └─Selection_10	3.33	cop	eq(test.t2.b, 5), gt(test.t2.a, 600)
│   └─TableScan_9	10000.00	cop	table:t2, partition:p3, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3.33	root	data:Selection_13
  └─Selection_13	3.33	cop	eq(test.t2.b, 5), gt(test.t2.a, 600)
    └─TableScan_12	10000.00	cop	table:t2, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where b = 5;
id	count	task	operator info
Union_11	50.00	root	
├─TableReader_14	10.00	root	data:Selection_13
│ └─Selection_13	10.00	cop	eq(test.t2.b, 5)
│   └─TableScan_12	10000.00	cop	table:t2, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_17	10.00	root	data:Selection_16
│ └─Selection_16	10.00	cop	eq(test.t2.b, 5)
│   └─TableScan_15	10000.00	cop	table:t2, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	10.00	root	data:Selection_19
│ └─Selection_19	10.00	cop	eq(test.t2.b, 5)
│   └─TableScan_18	10000.00	cop	table:t2, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_23	10.00	root	data:Selection_22
│ └─Selection_22	10.00	cop	eq(test.t2.b, 5)
│   └─TableScan_21	10000.00	cop	table:t2, partition:p3, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_26	10.00	root	data:Selection_25
  └─Selection_25	10.00	cop	eq(test.t2.b, 5)
    └─TableScan_24	10000.00	cop	table:t2, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
flush status;
update t2 set b = 100 where b = 6;
show status like 'Handler_read_rnd_next';
Variable_name	Value
flush status;
update t2 set a = 1002 where a = 1001;
show status like 'Handler_read_rnd_next';
Variable_name	Value
flush status;
update t2 set b = 6 where a = 600;
show status like 'Handler_read_rnd_next';
Variable_name	Value
flush status;
update t2 set b = 6 where a > 600 and a < 800;
show status like 'Handler_read_rnd_next';
Variable_name	Value
flush status;
delete from t2 where a > 600;
show status like 'Handler_read_rnd_next';
Variable_name	Value
drop table t2;
CREATE TABLE `t2` (
`a` int(11) default NULL,
`b` int(11) default NULL,
index (b)
)
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (200),
PARTITION p1 VALUES LESS THAN (400),
PARTITION p2 VALUES LESS THAN (600),
PARTITION p3 VALUES LESS THAN (800),
PARTITION p4 VALUES LESS THAN (1001));
insert into t2 select a,1 from t1 where a < 100;
insert into t2 select a,2 from t1 where a >= 200 and a < 300;
insert into t2 select a,3 from t1 where a >= 300 and a < 400;
insert into t2 select a,4 from t1 where a >= 400 and a < 500;
insert into t2 select a,5 from t1 where a >= 500 and a < 600;
insert into t2 select a,6 from t1 where a >= 600 and a < 700;
insert into t2 select a,7 from t1 where a >= 700 and a < 800;
insert into t2 select a,8 from t1 where a >= 800 and a < 900;
insert into t2 select a,9 from t1 where a >= 900 and a < 1001;
explain select * from t2;
id	count	task	operator info
Union_10	50000.00	root	
├─TableReader_12	10000.00	root	data:TableScan_11
│ └─TableScan_11	10000.00	cop	table:t2, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_14	10000.00	root	data:TableScan_13
│ └─TableScan_13	10000.00	cop	table:t2, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	10000.00	root	data:TableScan_15
│ └─TableScan_15	10000.00	cop	table:t2, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_18	10000.00	root	data:TableScan_17
│ └─TableScan_17	10000.00	cop	table:t2, partition:p3, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_20	10000.00	root	data:TableScan_19
  └─TableScan_19	10000.00	cop	table:t2, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where a = 101;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t2.a, 101)
  └─TableScan_6	10000.00	cop	table:t2, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where a = 550;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t2.a, 550)
  └─TableScan_6	10000.00	cop	table:t2, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where a = 833;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t2.a, 833)
  └─TableScan_6	10000.00	cop	table:t2, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where (a = 100 OR a = 900);
id	count	task	operator info
Union_8	40.00	root	
├─TableReader_11	20.00	root	data:Selection_10
│ └─Selection_10	20.00	cop	or(eq(test.t2.a, 100), eq(test.t2.a, 900))
│   └─TableScan_9	10000.00	cop	table:t2, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	20.00	root	data:Selection_13
  └─Selection_13	20.00	cop	or(eq(test.t2.a, 100), eq(test.t2.a, 900))
    └─TableScan_12	10000.00	cop	table:t2, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where (a > 100 AND a < 600);
id	count	task	operator info
Union_9	750.00	root	
├─TableReader_12	250.00	root	data:Selection_11
│ └─Selection_11	250.00	cop	gt(test.t2.a, 100), lt(test.t2.a, 600)
│   └─TableScan_10	10000.00	cop	table:t2, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	250.00	root	data:Selection_14
│ └─Selection_14	250.00	cop	gt(test.t2.a, 100), lt(test.t2.a, 600)
│   └─TableScan_13	10000.00	cop	table:t2, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	250.00	root	data:Selection_17
  └─Selection_17	250.00	cop	gt(test.t2.a, 100), lt(test.t2.a, 600)
    └─TableScan_16	10000.00	cop	table:t2, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where b = 4;
id	count	task	operator info
Union_11	50.00	root	
├─IndexLookUp_17	10.00	root	
│ ├─IndexScan_15	10.00	cop	table:t2, partition:p0, index:b, range:[4,4], keep order:false, stats:pseudo
│ └─TableScan_16	10.00	cop	table:t2, partition:p0, keep order:false, stats:pseudo
├─IndexLookUp_23	10.00	root	
│ ├─IndexScan_21	10.00	cop	table:t2, partition:p1, index:b, range:[4,4], keep order:false, stats:pseudo
│ └─TableScan_22	10.00	cop	table:t2, partition:p1, keep order:false, stats:pseudo
├─IndexLookUp_29	10.00	root	
│ ├─IndexScan_27	10.00	cop	table:t2, partition:p2, index:b, range:[4,4], keep order:false, stats:pseudo
│ └─TableScan_28	10.00	cop	table:t2, partition:p2, keep order:false, stats:pseudo
├─IndexLookUp_35	10.00	root	
│ ├─IndexScan_33	10.00	cop	table:t2, partition:p3, index:b, range:[4,4], keep order:false, stats:pseudo
│ └─TableScan_34	10.00	cop	table:t2, partition:p3, keep order:false, stats:pseudo
└─IndexLookUp_41	10.00	root	
  ├─IndexScan_39	10.00	cop	table:t2, partition:p4, index:b, range:[4,4], keep order:false, stats:pseudo
  └─TableScan_40	10.00	cop	table:t2, partition:p4, keep order:false, stats:pseudo
explain select * from t2 where b = 6;
id	count	task	operator info
Union_11	50.00	root	
├─IndexLookUp_17	10.00	root	
│ ├─IndexScan_15	10.00	cop	table:t2, partition:p0, index:b, range:[6,6], keep order:false, stats:pseudo
│ └─TableScan_16	10.00	cop	table:t2, partition:p0, keep order:false, stats:pseudo
├─IndexLookUp_23	10.00	root	
│ ├─IndexScan_21	10.00	cop	table:t2, partition:p1, index:b, range:[6,6], keep order:false, stats:pseudo
│ └─TableScan_22	10.00	cop	table:t2, partition:p1, keep order:false, stats:pseudo
├─IndexLookUp_29	10.00	root	
│ ├─IndexScan_27	10.00	cop	table:t2, partition:p2, index:b, range:[6,6], keep order:false, stats:pseudo
│ └─TableScan_28	10.00	cop	table:t2, partition:p2, keep order:false, stats:pseudo
├─IndexLookUp_35	10.00	root	
│ ├─IndexScan_33	10.00	cop	table:t2, partition:p3, index:b, range:[6,6], keep order:false, stats:pseudo
│ └─TableScan_34	10.00	cop	table:t2, partition:p3, keep order:false, stats:pseudo
└─IndexLookUp_41	10.00	root	
  ├─IndexScan_39	10.00	cop	table:t2, partition:p4, index:b, range:[6,6], keep order:false, stats:pseudo
  └─TableScan_40	10.00	cop	table:t2, partition:p4, keep order:false, stats:pseudo
explain select * from t2 where b in (1,3,5);
id	count	task	operator info
Union_11	150.00	root	
├─IndexLookUp_17	30.00	root	
│ ├─IndexScan_15	30.00	cop	table:t2, partition:p0, index:b, range:[1,1], [3,3], [5,5], keep order:false, stats:pseudo
│ └─TableScan_16	30.00	cop	table:t2, partition:p0, keep order:false, stats:pseudo
├─IndexLookUp_23	30.00	root	
│ ├─IndexScan_21	30.00	cop	table:t2, partition:p1, index:b, range:[1,1], [3,3], [5,5], keep order:false, stats:pseudo
│ └─TableScan_22	30.00	cop	table:t2, partition:p1, keep order:false, stats:pseudo
├─IndexLookUp_29	30.00	root	
│ ├─IndexScan_27	30.00	cop	table:t2, partition:p2, index:b, range:[1,1], [3,3], [5,5], keep order:false, stats:pseudo
│ └─TableScan_28	30.00	cop	table:t2, partition:p2, keep order:false, stats:pseudo
├─IndexLookUp_35	30.00	root	
│ ├─IndexScan_33	30.00	cop	table:t2, partition:p3, index:b, range:[1,1], [3,3], [5,5], keep order:false, stats:pseudo
│ └─TableScan_34	30.00	cop	table:t2, partition:p3, keep order:false, stats:pseudo
└─IndexLookUp_41	30.00	root	
  ├─IndexScan_39	30.00	cop	table:t2, partition:p4, index:b, range:[1,1], [3,3], [5,5], keep order:false, stats:pseudo
  └─TableScan_40	30.00	cop	table:t2, partition:p4, keep order:false, stats:pseudo
explain select * from t2 where b in (2,4,6);
id	count	task	operator info
Union_11	150.00	root	
├─IndexLookUp_17	30.00	root	
│ ├─IndexScan_15	30.00	cop	table:t2, partition:p0, index:b, range:[2,2], [4,4], [6,6], keep order:false, stats:pseudo
│ └─TableScan_16	30.00	cop	table:t2, partition:p0, keep order:false, stats:pseudo
├─IndexLookUp_23	30.00	root	
│ ├─IndexScan_21	30.00	cop	table:t2, partition:p1, index:b, range:[2,2], [4,4], [6,6], keep order:false, stats:pseudo
│ └─TableScan_22	30.00	cop	table:t2, partition:p1, keep order:false, stats:pseudo
├─IndexLookUp_29	30.00	root	
│ ├─IndexScan_27	30.00	cop	table:t2, partition:p2, index:b, range:[2,2], [4,4], [6,6], keep order:false, stats:pseudo
│ └─TableScan_28	30.00	cop	table:t2, partition:p2, keep order:false, stats:pseudo
├─IndexLookUp_35	30.00	root	
│ ├─IndexScan_33	30.00	cop	table:t2, partition:p3, index:b, range:[2,2], [4,4], [6,6], keep order:false, stats:pseudo
│ └─TableScan_34	30.00	cop	table:t2, partition:p3, keep order:false, stats:pseudo
└─IndexLookUp_41	30.00	root	
  ├─IndexScan_39	30.00	cop	table:t2, partition:p4, index:b, range:[2,2], [4,4], [6,6], keep order:false, stats:pseudo
  └─TableScan_40	30.00	cop	table:t2, partition:p4, keep order:false, stats:pseudo
explain select * from t2 where b in (7,8,9);
id	count	task	operator info
Union_11	150.00	root	
├─IndexLookUp_17	30.00	root	
│ ├─IndexScan_15	30.00	cop	table:t2, partition:p0, index:b, range:[7,7], [8,8], [9,9], keep order:false, stats:pseudo
│ └─TableScan_16	30.00	cop	table:t2, partition:p0, keep order:false, stats:pseudo
├─IndexLookUp_23	30.00	root	
│ ├─IndexScan_21	30.00	cop	table:t2, partition:p1, index:b, range:[7,7], [8,8], [9,9], keep order:false, stats:pseudo
│ └─TableScan_22	30.00	cop	table:t2, partition:p1, keep order:false, stats:pseudo
├─IndexLookUp_29	30.00	root	
│ ├─IndexScan_27	30.00	cop	table:t2, partition:p2, index:b, range:[7,7], [8,8], [9,9], keep order:false, stats:pseudo
│ └─TableScan_28	30.00	cop	table:t2, partition:p2, keep order:false, stats:pseudo
├─IndexLookUp_35	30.00	root	
│ ├─IndexScan_33	30.00	cop	table:t2, partition:p3, index:b, range:[7,7], [8,8], [9,9], keep order:false, stats:pseudo
│ └─TableScan_34	30.00	cop	table:t2, partition:p3, keep order:false, stats:pseudo
└─IndexLookUp_41	30.00	root	
  ├─IndexScan_39	30.00	cop	table:t2, partition:p4, index:b, range:[7,7], [8,8], [9,9], keep order:false, stats:pseudo
  └─TableScan_40	30.00	cop	table:t2, partition:p4, keep order:false, stats:pseudo
explain select * from t2 where b > 5;
id	count	task	operator info
Union_11	16666.67	root	
├─TableReader_14	3333.33	root	data:Selection_13
│ └─Selection_13	3333.33	cop	gt(test.t2.b, 5)
│   └─TableScan_12	10000.00	cop	table:t2, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_20	3333.33	root	data:Selection_19
│ └─Selection_19	3333.33	cop	gt(test.t2.b, 5)
│   └─TableScan_18	10000.00	cop	table:t2, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_26	3333.33	root	data:Selection_25
│ └─Selection_25	3333.33	cop	gt(test.t2.b, 5)
│   └─TableScan_24	10000.00	cop	table:t2, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_32	3333.33	root	data:Selection_31
│ └─Selection_31	3333.33	cop	gt(test.t2.b, 5)
│   └─TableScan_30	10000.00	cop	table:t2, partition:p3, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_38	3333.33	root	data:Selection_37
  └─Selection_37	3333.33	cop	gt(test.t2.b, 5)
    └─TableScan_36	10000.00	cop	table:t2, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where b > 5 and b < 8;
id	count	task	operator info
Union_11	1250.00	root	
├─IndexLookUp_17	250.00	root	
│ ├─IndexScan_15	250.00	cop	table:t2, partition:p0, index:b, range:(5,8), keep order:false, stats:pseudo
│ └─TableScan_16	250.00	cop	table:t2, partition:p0, keep order:false, stats:pseudo
├─IndexLookUp_23	250.00	root	
│ ├─IndexScan_21	250.00	cop	table:t2, partition:p1, index:b, range:(5,8), keep order:false, stats:pseudo
│ └─TableScan_22	250.00	cop	table:t2, partition:p1, keep order:false, stats:pseudo
├─IndexLookUp_29	250.00	root	
│ ├─IndexScan_27	250.00	cop	table:t2, partition:p2, index:b, range:(5,8), keep order:false, stats:pseudo
│ └─TableScan_28	250.00	cop	table:t2, partition:p2, keep order:false, stats:pseudo
├─IndexLookUp_35	250.00	root	
│ ├─IndexScan_33	250.00	cop	table:t2, partition:p3, index:b, range:(5,8), keep order:false, stats:pseudo
│ └─TableScan_34	250.00	cop	table:t2, partition:p3, keep order:false, stats:pseudo
└─IndexLookUp_41	250.00	root	
  ├─IndexScan_39	250.00	cop	table:t2, partition:p4, index:b, range:(5,8), keep order:false, stats:pseudo
  └─TableScan_40	250.00	cop	table:t2, partition:p4, keep order:false, stats:pseudo
explain select * from t2 where b > 5 and b < 7;
id	count	task	operator info
Union_11	1250.00	root	
├─IndexLookUp_17	250.00	root	
│ ├─IndexScan_15	250.00	cop	table:t2, partition:p0, index:b, range:(5,7), keep order:false, stats:pseudo
│ └─TableScan_16	250.00	cop	table:t2, partition:p0, keep order:false, stats:pseudo
├─IndexLookUp_23	250.00	root	
│ ├─IndexScan_21	250.00	cop	table:t2, partition:p1, index:b, range:(5,7), keep order:false, stats:pseudo
│ └─TableScan_22	250.00	cop	table:t2, partition:p1, keep order:false, stats:pseudo
├─IndexLookUp_29	250.00	root	
│ ├─IndexScan_27	250.00	cop	table:t2, partition:p2, index:b, range:(5,7), keep order:false, stats:pseudo
│ └─TableScan_28	250.00	cop	table:t2, partition:p2, keep order:false, stats:pseudo
├─IndexLookUp_35	250.00	root	
│ ├─IndexScan_33	250.00	cop	table:t2, partition:p3, index:b, range:(5,7), keep order:false, stats:pseudo
│ └─TableScan_34	250.00	cop	table:t2, partition:p3, keep order:false, stats:pseudo
└─IndexLookUp_41	250.00	root	
  ├─IndexScan_39	250.00	cop	table:t2, partition:p4, index:b, range:(5,7), keep order:false, stats:pseudo
  └─TableScan_40	250.00	cop	table:t2, partition:p4, keep order:false, stats:pseudo
explain select * from t2 where b > 0 and b < 5;
id	count	task	operator info
Union_11	1250.00	root	
├─IndexLookUp_17	250.00	root	
│ ├─IndexScan_15	250.00	cop	table:t2, partition:p0, index:b, range:(0,5), keep order:false, stats:pseudo
│ └─TableScan_16	250.00	cop	table:t2, partition:p0, keep order:false, stats:pseudo
├─IndexLookUp_23	250.00	root	
│ ├─IndexScan_21	250.00	cop	table:t2, partition:p1, index:b, range:(0,5), keep order:false, stats:pseudo
│ └─TableScan_22	250.00	cop	table:t2, partition:p1, keep order:false, stats:pseudo
├─IndexLookUp_29	250.00	root	
│ ├─IndexScan_27	250.00	cop	table:t2, partition:p2, index:b, range:(0,5), keep order:false, stats:pseudo
│ └─TableScan_28	250.00	cop	table:t2, partition:p2, keep order:false, stats:pseudo
├─IndexLookUp_35	250.00	root	
│ ├─IndexScan_33	250.00	cop	table:t2, partition:p3, index:b, range:(0,5), keep order:false, stats:pseudo
│ └─TableScan_34	250.00	cop	table:t2, partition:p3, keep order:false, stats:pseudo
└─IndexLookUp_41	250.00	root	
  ├─IndexScan_39	250.00	cop	table:t2, partition:p4, index:b, range:(0,5), keep order:false, stats:pseudo
  └─TableScan_40	250.00	cop	table:t2, partition:p4, keep order:false, stats:pseudo
flush status;
update t2 set a = 111 where b = 10;
show status like 'Handler_read_rnd_next';
Variable_name	Value
show status like 'Handler_read_key';
Variable_name	Value
flush status;
update t2 set a = 111 where b in (5,6);
show status like 'Handler_read_rnd_next';
Variable_name	Value
show status like 'Handler_read_key';
Variable_name	Value
flush status;
update t2 set a = 222 where b = 7;
show status like 'Handler_read_rnd_next';
Variable_name	Value
show status like 'Handler_read_key';
Variable_name	Value
flush status;
delete from t2 where b = 7;
show status like 'Handler_read_rnd_next';
Variable_name	Value
show status like 'Handler_read_key';
Variable_name	Value
flush status;
delete from t2 where b > 5;
show status like 'Handler_read_rnd_next';
Variable_name	Value
show status like 'Handler_read_key';
Variable_name	Value
show status like 'Handler_read_prev';
Variable_name	Value
show status like 'Handler_read_next';
Variable_name	Value
flush status;
delete from t2 where b < 5 or b > 3;
show status like 'Handler_read_rnd_next';
Variable_name	Value
show status like 'Handler_read_key';
Variable_name	Value
show status like 'Handler_read_prev';
Variable_name	Value
show status like 'Handler_read_next';
Variable_name	Value
drop table t1, t2;
create table t1 (s1 int);
explain select 1 from t1 union all select 2;
id	count	task	operator info
Union_8	10001.00	root	
├─Projection_10	10000.00	root	1
│ └─TableReader_12	10000.00	root	data:TableScan_11
│   └─TableScan_11	10000.00	cop	table:t1, range:[-inf,+inf], keep order:false, stats:pseudo
└─Projection_14	1.00	root	2
  └─TableDual_15	1.00	root	rows:1
drop table t1;
create table t1 (a int)
partition by range(a) (
partition p0 values less than (64),
partition p1 values less than (128),
partition p2 values less than (255)
);
create table t2 (a int)
partition by range(a+0) (
partition p0 values less than (64),
partition p1 values less than (128),
partition p2 values less than (255)
);
insert into t1 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE);
insert into t2 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE);
explain select * from t1 where a=0;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.a, 0)
  └─TableScan_6	10000.00	cop	table:t1, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where a=0;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t2.a, 0)
  └─TableScan_6	10000.00	cop	table:t2, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t1 where a=0xFE;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t1.a, 254)
  └─TableScan_6	10000.00	cop	table:t1, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where a=0xFE;
id	count	task	operator info
TableReader_8	10.00	root	data:Selection_7
└─Selection_7	10.00	cop	eq(test.t2.a, 254)
  └─TableScan_6	10000.00	cop	table:t2, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t1 where a > 0xFE AND a <= 0xFF;
id	count	task	operator info
TableDual_6	0.00	root	rows:0
explain select * from t2 where a > 0xFE AND a <= 0xFF;
id	count	task	operator info
Union_9	750.00	root	
├─TableReader_12	250.00	root	data:Selection_11
│ └─Selection_11	250.00	cop	gt(test.t2.a, 254), le(test.t2.a, 255)
│   └─TableScan_10	10000.00	cop	table:t2, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	250.00	root	data:Selection_14
│ └─Selection_14	250.00	cop	gt(test.t2.a, 254), le(test.t2.a, 255)
│   └─TableScan_13	10000.00	cop	table:t2, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	250.00	root	data:Selection_17
  └─Selection_17	250.00	cop	gt(test.t2.a, 254), le(test.t2.a, 255)
    └─TableScan_16	10000.00	cop	table:t2, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t1 where a >= 0xFE AND a <= 0xFF;
id	count	task	operator info
TableReader_8	250.00	root	data:Selection_7
└─Selection_7	250.00	cop	ge(test.t1.a, 254), le(test.t1.a, 255)
  └─TableScan_6	10000.00	cop	table:t1, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where a >= 0xFE AND a <= 0xFF;
id	count	task	operator info
Union_9	750.00	root	
├─TableReader_12	250.00	root	data:Selection_11
│ └─Selection_11	250.00	cop	ge(test.t2.a, 254), le(test.t2.a, 255)
│   └─TableScan_10	10000.00	cop	table:t2, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	250.00	root	data:Selection_14
│ └─Selection_14	250.00	cop	ge(test.t2.a, 254), le(test.t2.a, 255)
│   └─TableScan_13	10000.00	cop	table:t2, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	250.00	root	data:Selection_17
  └─Selection_17	250.00	cop	ge(test.t2.a, 254), le(test.t2.a, 255)
    └─TableScan_16	10000.00	cop	table:t2, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t1 where a < 64 AND a >= 63;
id	count	task	operator info
TableReader_8	250.00	root	data:Selection_7
└─Selection_7	250.00	cop	ge(test.t1.a, 63), lt(test.t1.a, 64)
  └─TableScan_6	10000.00	cop	table:t1, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where a < 64 AND a >= 63;
id	count	task	operator info
Union_9	750.00	root	
├─TableReader_12	250.00	root	data:Selection_11
│ └─Selection_11	250.00	cop	ge(test.t2.a, 63), lt(test.t2.a, 64)
│   └─TableScan_10	10000.00	cop	table:t2, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	250.00	root	data:Selection_14
│ └─Selection_14	250.00	cop	ge(test.t2.a, 63), lt(test.t2.a, 64)
│   └─TableScan_13	10000.00	cop	table:t2, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	250.00	root	data:Selection_17
  └─Selection_17	250.00	cop	ge(test.t2.a, 63), lt(test.t2.a, 64)
    └─TableScan_16	10000.00	cop	table:t2, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t1 where a <= 64 AND a >= 63;
id	count	task	operator info
Union_8	500.00	root	
├─TableReader_11	250.00	root	data:Selection_10
│ └─Selection_10	250.00	cop	ge(test.t1.a, 63), le(test.t1.a, 64)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	250.00	root	data:Selection_13
  └─Selection_13	250.00	cop	ge(test.t1.a, 63), le(test.t1.a, 64)
    └─TableScan_12	10000.00	cop	table:t1, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t2 where a <= 64 AND a >= 63;
id	count	task	operator info
Union_9	750.00	root	
├─TableReader_12	250.00	root	data:Selection_11
│ └─Selection_11	250.00	cop	ge(test.t2.a, 63), le(test.t2.a, 64)
│   └─TableScan_10	10000.00	cop	table:t2, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	250.00	root	data:Selection_14
│ └─Selection_14	250.00	cop	ge(test.t2.a, 63), le(test.t2.a, 64)
│   └─TableScan_13	10000.00	cop	table:t2, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	250.00	root	data:Selection_17
  └─Selection_17	250.00	cop	ge(test.t2.a, 63), le(test.t2.a, 64)
    └─TableScan_16	10000.00	cop	table:t2, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
drop table t1;
drop table t2;
create table t1(a bigint unsigned not null) partition by range(a+0) (
partition p1 values less than (10),
partition p2 values less than (20),
partition p3 values less than (2305561538531885056),
partition p4 values less than (2305561538531950591)
);
insert into t1 values (9),(19),(0xFFFF0000FFFF000-1), (0xFFFF0000FFFFFFF-1);
insert into t1 values (9),(19),(0xFFFF0000FFFF000-1), (0xFFFF0000FFFFFFF-1);
explain select * from t1 where
a >= 2305561538531885056-10 and a <= 2305561538531885056-8;
id	count	task	operator info
Union_10	1000.00	root	
├─TableReader_13	250.00	root	data:Selection_12
│ └─Selection_12	250.00	cop	ge(test.t1.a, 2305561538531885046), le(test.t1.a, 2305561538531885048)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	250.00	root	data:Selection_15
│ └─Selection_15	250.00	cop	ge(test.t1.a, 2305561538531885046), le(test.t1.a, 2305561538531885048)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	250.00	root	data:Selection_18
│ └─Selection_18	250.00	cop	ge(test.t1.a, 2305561538531885046), le(test.t1.a, 2305561538531885048)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p3, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	250.00	root	data:Selection_21
  └─Selection_21	250.00	cop	ge(test.t1.a, 2305561538531885046), le(test.t1.a, 2305561538531885048)
    └─TableScan_20	10000.00	cop	table:t1, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t1 where
a > 0xFFFFFFFFFFFFFFEC and a < 0xFFFFFFFFFFFFFFEE;
id	count	task	operator info
Union_10	1000.00	root	
├─TableReader_13	250.00	root	data:Selection_12
│ └─Selection_12	250.00	cop	gt(test.t1.a, 18446744073709551596), lt(test.t1.a, 18446744073709551598)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	250.00	root	data:Selection_15
│ └─Selection_15	250.00	cop	gt(test.t1.a, 18446744073709551596), lt(test.t1.a, 18446744073709551598)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	250.00	root	data:Selection_18
│ └─Selection_18	250.00	cop	gt(test.t1.a, 18446744073709551596), lt(test.t1.a, 18446744073709551598)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p3, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	250.00	root	data:Selection_21
  └─Selection_21	250.00	cop	gt(test.t1.a, 18446744073709551596), lt(test.t1.a, 18446744073709551598)
    └─TableScan_20	10000.00	cop	table:t1, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t1 where a>=0 and a <= 0xFFFFFFFFFFFFFFFF;
id	count	task	operator info
Union_10	1000.00	root	
├─TableReader_13	250.00	root	data:Selection_12
│ └─Selection_12	250.00	cop	ge(test.t1.a, 0), le(test.t1.a, 18446744073709551615)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	250.00	root	data:Selection_15
│ └─Selection_15	250.00	cop	ge(test.t1.a, 0), le(test.t1.a, 18446744073709551615)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	250.00	root	data:Selection_18
│ └─Selection_18	250.00	cop	ge(test.t1.a, 0), le(test.t1.a, 18446744073709551615)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p3, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	250.00	root	data:Selection_21
  └─Selection_21	250.00	cop	ge(test.t1.a, 0), le(test.t1.a, 18446744073709551615)
    └─TableScan_20	10000.00	cop	table:t1, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
drop table t1;
create table t1 (a bigint) partition by range(a+0) (
partition p1 values less than (-1000),
partition p2 values less than (-10),
partition p3 values less than (10),
partition p4 values less than (1000)
);
insert into t1 values (-15),(-5),(5),(15),(-15),(-5),(5),(15);
explain select * from t1 where a>-2 and a <=0;
id	count	task	operator info
Union_10	1000.00	root	
├─TableReader_13	250.00	root	data:Selection_12
│ └─Selection_12	250.00	cop	gt(test.t1.a, -2), le(test.t1.a, 0)
│   └─TableScan_11	10000.00	cop	table:t1, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_16	250.00	root	data:Selection_15
│ └─Selection_15	250.00	cop	gt(test.t1.a, -2), le(test.t1.a, 0)
│   └─TableScan_14	10000.00	cop	table:t1, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_19	250.00	root	data:Selection_18
│ └─Selection_18	250.00	cop	gt(test.t1.a, -2), le(test.t1.a, 0)
│   └─TableScan_17	10000.00	cop	table:t1, partition:p3, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22	250.00	root	data:Selection_21
  └─Selection_21	250.00	cop	gt(test.t1.a, -2), le(test.t1.a, 0)
    └─TableScan_20	10000.00	cop	table:t1, partition:p4, range:[-inf,+inf], keep order:false, stats:pseudo
drop table t1;
CREATE TABLE t1 ( recdate  DATETIME NOT NULL )
PARTITION BY RANGE( TO_DAYS(recdate) ) (
PARTITION p0 VALUES LESS THAN ( TO_DAYS('2007-03-08') ),
PARTITION p1 VALUES LESS THAN ( TO_DAYS('2007-04-01') )
);
INSERT INTO t1 VALUES ('2007-03-01 12:00:00');
INSERT INTO t1 VALUES ('2007-03-07 12:00:00');
INSERT INTO t1 VALUES ('2007-03-08 12:00:00');
INSERT INTO t1 VALUES ('2007-03-15 12:00:00');
explain select * from t1 where recdate < '2007-03-08 00:00:00';
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.recdate, 2007-03-08 00:00:00.000000)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.recdate, 2007-03-08 00:00:00.000000)
    └─TableScan_12	10000.00	cop	table:t1, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
drop table t1;
CREATE TABLE t1 ( recdate  DATETIME NOT NULL )
PARTITION BY RANGE( YEAR(recdate) ) (
PARTITION p0 VALUES LESS THAN (2006),
PARTITION p1 VALUES LESS THAN (2007)
);
INSERT INTO t1 VALUES ('2005-03-01 12:00:00');
INSERT INTO t1 VALUES ('2005-03-01 12:00:00');
INSERT INTO t1 VALUES ('2006-03-01 12:00:00');
INSERT INTO t1 VALUES ('2006-03-01 12:00:00');
explain select * from t1 where recdate < '2006-01-01 00:00:00';
id	count	task	operator info
Union_8	6646.67	root	
├─TableReader_11	3323.33	root	data:Selection_10
│ └─Selection_10	3323.33	cop	lt(test.t1.recdate, 2006-01-01 00:00:00.000000)
│   └─TableScan_9	10000.00	cop	table:t1, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	3323.33	root	data:Selection_13
  └─Selection_13	3323.33	cop	lt(test.t1.recdate, 2006-01-01 00:00:00.000000)
    └─TableScan_12	10000.00	cop	table:t1, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
drop table t1;
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (a int)
partition by range(a+0) (
partition p0 values less than (64),
partition p1 values less than (128),
partition p2 values less than (255)
);
insert into t1 select A.a + 10*B.a from t0 A, t0 B;
explain select * from t1 where a between 10 and 13;
id	count	task	operator info
Union_9	750.00	root	
├─TableReader_12	250.00	root	data:Selection_11
│ └─Selection_11	250.00	cop	ge(test.t1.a, 10), le(test.t1.a, 13)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	250.00	root	data:Selection_14
│ └─Selection_14	250.00	cop	ge(test.t1.a, 10), le(test.t1.a, 13)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	250.00	root	data:Selection_17
  └─Selection_17	250.00	cop	ge(test.t1.a, 10), le(test.t1.a, 13)
    └─TableScan_16	10000.00	cop	table:t1, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t1 where a between 10 and 10+33;
id	count	task	operator info
Union_9	750.00	root	
├─TableReader_12	250.00	root	data:Selection_11
│ └─Selection_11	250.00	cop	ge(test.t1.a, 10), le(test.t1.a, 43)
│   └─TableScan_10	10000.00	cop	table:t1, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15	250.00	root	data:Selection_14
│ └─Selection_14	250.00	cop	ge(test.t1.a, 10), le(test.t1.a, 43)
│   └─TableScan_13	10000.00	cop	table:t1, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18	250.00	root	data:Selection_17
  └─Selection_17	250.00	cop	ge(test.t1.a, 10), le(test.t1.a, 43)
    └─TableScan_16	10000.00	cop	table:t1, partition:p2, range:[-inf,+inf], keep order:false, stats:pseudo
drop table t0, t1;
drop table if exists t;
create table t(a timestamp) partition by range(unix_timestamp(a)) (partition p0 values less than(unix_timestamp('2019-02-16 14:20:00')), partition p1 values less than (maxvalue));
explain select * from t where a between timestamp'2019-02-16 14:19:00' and timestamp'2019-02-16 14:21:00';
id	count	task	operator info
Union_8	500.00	root	
├─TableReader_11	250.00	root	data:Selection_10
│ └─Selection_10	250.00	cop	ge(test.t.a, 2019-02-16 14:19:00), le(test.t.a, 2019-02-16 14:21:00)
│   └─TableScan_9	10000.00	cop	table:t, partition:p0, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_14	250.00	root	data:Selection_13
  └─Selection_13	250.00	cop	ge(test.t.a, 2019-02-16 14:19:00), le(test.t.a, 2019-02-16 14:21:00)
    └─TableScan_12	10000.00	cop	table:t, partition:p1, range:[-inf,+inf], keep order:false, stats:pseudo
