diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/partition_error.result | 8 | ||||
-rw-r--r-- | mysql-test/r/partition_hash.result | 14 | ||||
-rw-r--r-- | mysql-test/r/partition_mgm.result | 6 | ||||
-rw-r--r-- | mysql-test/r/partition_pruning.result | 58 | ||||
-rw-r--r-- | mysql-test/r/partition_range.result | 34 | ||||
-rw-r--r-- | mysql-test/t/partition_error.test | 8 | ||||
-rw-r--r-- | mysql-test/t/partition_hash.test | 12 | ||||
-rw-r--r-- | mysql-test/t/partition_mgm.test | 2 | ||||
-rw-r--r-- | mysql-test/t/partition_pruning.test | 58 | ||||
-rw-r--r-- | mysql-test/t/partition_range.test | 26 |
10 files changed, 130 insertions, 96 deletions
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index 4b01b759902..41829216178 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -25,7 +25,7 @@ partitions 3 (partition x1 values in (1,2,9,4) tablespace ts1, partition x2 values in (3, 11, 5, 7) tablespace ts2, partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3); -ERROR HY000: The PARTITION function returns the wrong type +ERROR HY000: This partition function is not allowed CREATE TABLE t1 ( a int not null, b int not null, @@ -89,7 +89,7 @@ partitions 3 (partition x1 tablespace ts1, partition x2 tablespace ts2, partition x3 tablespace ts3); -ERROR HY000: The PARTITION function returns the wrong type +ERROR HY000: This partition function is not allowed CREATE TABLE t1 ( a int not null, b int not null, @@ -422,7 +422,7 @@ partition by range (sin(a)) partitions 2 (partition x1 values less than (4), partition x2 values less than (5)); -ERROR HY000: The PARTITION function returns the wrong type +ERROR HY000: This partition function is not allowed CREATE TABLE t1 ( a int not null, b int not null, @@ -619,4 +619,4 @@ partition by range (a + (select count(*) from t1)) ERROR HY000: This partition function is not allowed create table t1 (a char(10)) partition by hash (extractvalue(a,'a')); -ERROR HY000: The PARTITION function returns the wrong type +ERROR HY000: This partition function is not allowed diff --git a/mysql-test/r/partition_hash.result b/mysql-test/r/partition_hash.result index 7ef3ee5c6c8..9a82a36d902 100644 --- a/mysql-test/r/partition_hash.result +++ b/mysql-test/r/partition_hash.result @@ -1,18 +1,4 @@ drop table if exists t1; -create table t1 (a varchar(10) charset latin1 collate latin1_bin) -partition by hash(length(a)) -partitions 10; -insert into t1 values (''),(' '),('a'),('a '),('a '); -explain partitions select * from t1 where a='a '; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where -explain partitions select * from t1 where a='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where -explain partitions select * from t1 where a='a ' OR a='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where -drop table t1; create table t1 (a int unsigned) partition by hash(a div 2) partitions 4; diff --git a/mysql-test/r/partition_mgm.result b/mysql-test/r/partition_mgm.result index 9b5a34bda50..04ac603fea7 100644 --- a/mysql-test/r/partition_mgm.result +++ b/mysql-test/r/partition_mgm.result @@ -10,13 +10,13 @@ subpartition sp01, subpartition sp02)); ERROR HY000: Wrong number of subpartitions defined, mismatch with previous setting drop table t1; CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30)) -PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2; +PARTITION BY HASH(YEAR(f_date)) PARTITIONS 2; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2 */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) PARTITIONS 2 */ hello/master-data/test/t1#P#p0.MYD hello/master-data/test/t1#P#p0.MYI hello/master-data/test/t1#P#p1.MYD @@ -29,7 +29,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `f_date` date DEFAULT NULL, `f_varchar` varchar(30) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 1 */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (YEAR(f_date)) PARTITIONS 1 */ hello/master-data/test/t1#P#p0.MYD hello/master-data/test/t1#P#p0.MYI hello/master-data/test/t1.frm diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index 5fc0058356d..1143b1e4296 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -677,13 +677,12 @@ f_int1 f_int2 9 9 drop table t1; create table t1 (a char(10) binary) -partition by list(length(a)) -(partition p1 values in (1), -partition p2 values in (2), -partition p3 values in (3), -partition p4 values in (4), -partition p5 values in (5) -); +partition by list(ascii(a)) +(partition p1 values in (ascii('a')), +partition p2 values in (ascii('b')), +partition p3 values in (ascii('c')), +partition p4 values in (ascii('d')), +partition p5 values in (ascii('e'))); insert into t1 values ('a'),('bb'),('ccc'),('dddd'),('eeEee'); select * from t1 where a>='a' and a <= 'dddd'; a @@ -848,22 +847,57 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables drop table t1; create table t1 (a int) -partition by range((a & 0xFF) << 56) ( -partition p0 values less than (0x40 << 56), -partition p1 values less than (0x80 << 56), -partition p2 values less than (0xFF << 56) +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 partitions select * from t1 where a=0; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where +explain partitions select * from t2 where a=0; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a=0xFE; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 Using where -explain partitions select * from t1 where a>0xFE and a<= 0xFF; +explain partitions select * from t2 where a=0xFE; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 2 Using where +explain partitions select * from t1 where a > 0xFE AND a <= 0xFF; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +explain partitions select * from t2 where a > 0xFE AND a <= 0xFF; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +explain partitions select * from t1 where a >= 0xFE AND a <= 0xFF; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 Using where +explain partitions select * from t2 where a >= 0xFE AND a <= 0xFF; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 2 Using where +explain partitions select * from t1 where a < 64 AND a >= 63; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where +explain partitions select * from t2 where a < 64 AND a >= 63; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where +explain partitions select * from t1 where a <= 64 AND a >= 63; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 4 Using where +explain partitions select * from t2 where a <= 64 AND a >= 63; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 4 Using where 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), diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result index d39b39f413a..e9ebd5ba2cf 100644 --- a/mysql-test/r/partition_range.result +++ b/mysql-test/r/partition_range.result @@ -1,36 +1,36 @@ drop table if exists t1; create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int) -partition by range (length(a) * b) -(partition p0 values less than (2), partition p1 values less than (400)); +partition by range (ascii(a) * b) +(partition p0 values less than (2), partition p1 values less than (4000)); insert into t1 values ('a ', 2),('a',3); drop table t1; create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int) -partition by range (b* length(a) * b) -(partition p0 values less than (2), partition p1 values less than (400)); +partition by range (b* ascii(a) * b) +(partition p0 values less than (2), partition p1 values less than (4000)); insert into t1 values ('a ', 2),('a',3); drop table t1; create table t1 (a varchar(10) charset latin1 collate latin1_bin, b varchar(10) charset latin1 collate latin1_bin) -partition by range (length(b) * length(a)) -(partition p0 values less than (2), partition p1 values less than (400)); +partition by range (ascii(b) * ascii(a)) +(partition p0 values less than (2), partition p1 values less than (40000)); insert into t1 values ('a ', 'b '),('a','b'); drop table t1; create table t1 (a varchar(10) charset latin1 collate latin1_bin, b varchar(10) charset latin1 collate latin1_bin) -partition by range (length(a) * length(b)) -(partition p0 values less than (2), partition p1 values less than (400)); +partition by range (ascii(a) * ascii(b)) +(partition p0 values less than (2), partition p1 values less than (40000)); insert into t1 values ('a ', 'b '),('a','b'); drop table t1; create table t1 (a varchar(10) charset latin1 collate latin1_bin, b varchar(10) charset latin1 collate latin1_bin, c int) -partition by range (length(a) * c) -(partition p0 values less than (2), partition p1 values less than (400)); +partition by range (ascii(a) * c) +(partition p0 values less than (2), partition p1 values less than (4000)); insert into t1 values ('a ', 'b ', 2),('a','b', 3); drop table t1; create table t1 (a varchar(10) charset latin1 collate latin1_bin, b varchar(10) charset latin1 collate latin1_bin, c int) -partition by range (c * length(a)) -(partition p0 values less than (2), partition p1 values less than (400)); +partition by range (c * ascii(a)) +(partition p0 values less than (2), partition p1 values less than (4000)); insert into t1 values ('a ', 'b ', 2),('a','b', 3); drop table t1; create table t1 (a int unsigned) @@ -109,7 +109,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 Using where explain partitions select * from t1 where a > 1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables drop table t1; CREATE TABLE t1 ( a int not null, @@ -744,7 +744,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p407,p408,p409,p507,p508,p509 ALL NULL NULL NULL NULL 18 Using where DROP TABLE t1; create table t1 (a varchar(20)) -partition by range (crc32(md5(a))) +partition by range (ascii(a)) (partition p0 values less than (100), partition p1 values less than maxvalue); insert into t1 values ("12345678901234567890"); @@ -761,16 +761,16 @@ B2345678901234567890 1234567890123456 explain partitions select * from t1 where a = "12345678901234567890"; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where explain partitions select * from t1 where a = "12345678901234567890" OR a = "A2345678901234567890" OR a = "B2345678901234567890" OR a = "C2345678901234567890"; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where explain partitions select * from t1 where a = "01234567890123456"; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where select * from t1 where a = "01234567890123456"; a select * from t1 where a = "12345678901234567890" OR diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index 20703b979f1..fa5055b2981 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -33,7 +33,7 @@ partitions 2; # # Partition by key list, wrong result type # ---error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 ( a int not null, b int not null, @@ -109,7 +109,7 @@ partitions 3 # # Partition by hash, invalid result type # ---error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 ( a int not null, b int not null, @@ -533,7 +533,7 @@ partitions 2 # # Partition by range, wrong result type of partition function # ---error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 ( a int not null, b int not null, @@ -790,7 +790,7 @@ partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00'))); create table t1 (a int) partition by range (a + (select count(*) from t1)) (partition p1 values less than (1)); --- error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED create table t1 (a char(10)) partition by hash (extractvalue(a,'a')); diff --git a/mysql-test/t/partition_hash.test b/mysql-test/t/partition_hash.test index d3f1a5f4892..3304f30fb1a 100644 --- a/mysql-test/t/partition_hash.test +++ b/mysql-test/t/partition_hash.test @@ -10,18 +10,6 @@ drop table if exists t1; --enable_warnings # -# BUG 18198: Partition functions handling -# -create table t1 (a varchar(10) charset latin1 collate latin1_bin) -partition by hash(length(a)) -partitions 10; -insert into t1 values (''),(' '),('a'),('a '),('a '); -explain partitions select * from t1 where a='a '; -explain partitions select * from t1 where a='a'; -explain partitions select * from t1 where a='a ' OR a='a'; -drop table t1; - -# # More partition pruning tests, especially on interval walking # create table t1 (a int unsigned) diff --git a/mysql-test/t/partition_mgm.test b/mysql-test/t/partition_mgm.test index 8458d47d634..a06f8d1aee5 100644 --- a/mysql-test/t/partition_mgm.test +++ b/mysql-test/t/partition_mgm.test @@ -20,7 +20,7 @@ subpartition sp01, subpartition sp02)); drop table t1; CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30)) -PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2; +PARTITION BY HASH(YEAR(f_date)) PARTITIONS 2; SHOW CREATE TABLE t1; --replace_result $MYSQLTEST_VARDIR "hello" diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index a60846f18ff..cef57bd9356 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -539,13 +539,12 @@ drop table t1; # part2: bug in pruning code create table t1 (a char(10) binary) -partition by list(length(a)) - (partition p1 values in (1), - partition p2 values in (2), - partition p3 values in (3), - partition p4 values in (4), - partition p5 values in (5) -); +partition by list(ascii(a)) + (partition p1 values in (ascii('a')), + partition p2 values in (ascii('b')), + partition p3 values in (ascii('c')), + partition p4 values in (ascii('d')), + partition p5 values in (ascii('e'))); insert into t1 values ('a'),('bb'),('ccc'),('dddd'),('eeEee'); select * from t1 where a>='a' and a <= 'dddd'; explain partitions select * from t1 where a>='a' and a <= 'dddd'; @@ -692,20 +691,47 @@ explain partitions select * from t1 where a = 18446744073709551000; explain partitions select * from t1 where a = 18446744073709551613; explain partitions select * from t1 where a = 18446744073709551614; drop table t1; - -create table t1 (a int) - partition by range((a & 0xFF) << 56) ( - partition p0 values less than (0x40 << 56), - partition p1 values less than (0x80 << 56), - partition p2 values less than (0xFF << 56) +# +# Test all variants of usage for interval_via_mapping +# and interval_via_walking +# +# t1 will use interval_via_mapping since it uses a +# monotonic function, whereas t2 will use +# interval_via_walking since the intervals are short +# and the function isn't monotonic (it is, but it isn't +# discovered in this version). +# + 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) ); -insert into t1 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE); +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 partitions select * from t1 where a=0; +explain partitions select * from t2 where a=0; explain partitions select * from t1 where a=0xFE; -explain partitions select * from t1 where a>0xFE and a<= 0xFF; +explain partitions select * from t2 where a=0xFE; +explain partitions select * from t1 where a > 0xFE AND a <= 0xFF; +explain partitions select * from t2 where a > 0xFE AND a <= 0xFF; +explain partitions select * from t1 where a >= 0xFE AND a <= 0xFF; +explain partitions select * from t2 where a >= 0xFE AND a <= 0xFF; +explain partitions select * from t1 where a < 64 AND a >= 63; +explain partitions select * from t2 where a < 64 AND a >= 63; +explain partitions select * from t1 where a <= 64 AND a >= 63; +explain partitions select * from t2 where a <= 64 AND a >= 63; 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), diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test index 84f67febe8b..219637d6f81 100644 --- a/mysql-test/t/partition_range.test +++ b/mysql-test/t/partition_range.test @@ -13,42 +13,42 @@ drop table if exists t1; # BUG 18198: Various tests for partition functions # create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int) -partition by range (length(a) * b) -(partition p0 values less than (2), partition p1 values less than (400)); +partition by range (ascii(a) * b) +(partition p0 values less than (2), partition p1 values less than (4000)); insert into t1 values ('a ', 2),('a',3); drop table t1; create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int) -partition by range (b* length(a) * b) -(partition p0 values less than (2), partition p1 values less than (400)); +partition by range (b* ascii(a) * b) +(partition p0 values less than (2), partition p1 values less than (4000)); insert into t1 values ('a ', 2),('a',3); drop table t1; create table t1 (a varchar(10) charset latin1 collate latin1_bin, b varchar(10) charset latin1 collate latin1_bin) -partition by range (length(b) * length(a)) -(partition p0 values less than (2), partition p1 values less than (400)); +partition by range (ascii(b) * ascii(a)) +(partition p0 values less than (2), partition p1 values less than (40000)); insert into t1 values ('a ', 'b '),('a','b'); drop table t1; create table t1 (a varchar(10) charset latin1 collate latin1_bin, b varchar(10) charset latin1 collate latin1_bin) -partition by range (length(a) * length(b)) -(partition p0 values less than (2), partition p1 values less than (400)); +partition by range (ascii(a) * ascii(b)) +(partition p0 values less than (2), partition p1 values less than (40000)); insert into t1 values ('a ', 'b '),('a','b'); drop table t1; create table t1 (a varchar(10) charset latin1 collate latin1_bin, b varchar(10) charset latin1 collate latin1_bin, c int) -partition by range (length(a) * c) -(partition p0 values less than (2), partition p1 values less than (400)); +partition by range (ascii(a) * c) +(partition p0 values less than (2), partition p1 values less than (4000)); insert into t1 values ('a ', 'b ', 2),('a','b', 3); drop table t1; create table t1 (a varchar(10) charset latin1 collate latin1_bin, b varchar(10) charset latin1 collate latin1_bin, c int) -partition by range (c * length(a)) -(partition p0 values less than (2), partition p1 values less than (400)); +partition by range (c * ascii(a)) +(partition p0 values less than (2), partition p1 values less than (4000)); insert into t1 values ('a ', 'b ', 2),('a','b', 3); drop table t1; @@ -734,7 +734,7 @@ DROP TABLE t1; # Bug 18198: Try with a couple of cases using VARCHAR fields in # partition function. create table t1 (a varchar(20)) -partition by range (crc32(md5(a))) +partition by range (ascii(a)) (partition p0 values less than (100), partition p1 values less than maxvalue); |