forked from mysql/mysql-server
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #246 from PeterWeiWang/mysql-8.0.25-olap-kp
support for parallel queries
- Loading branch information
Showing
51 changed files
with
96,136 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
drop table if exists t1; | ||
CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id)); | ||
insert into t1 values ('000000000001'),('000000000002'); | ||
analyze table t1; | ||
Table Op Msg_type Msg_text | ||
test.t1 analyze status OK | ||
explain select * from t1 where id=000000000001; | ||
id select_type table partitions type possible_keys key key_len ref rows filtered Extra | ||
1 SIMPLE <gather2> NULL ALL NULL NULL NULL NULL 2 50.00 Parallel execute (1 workers) | ||
2 SIMPLE t1 NULL index PRIMARY PRIMARY 48 NULL 2 50.00 Using where; Using index | ||
Warnings: | ||
Warning 1739 Cannot use ref access on index 'PRIMARY' due to type or collation conversion on field 'id' | ||
Warning 1739 Cannot use range access on index 'PRIMARY' due to type or collation conversion on field 'id' | ||
Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`id` = 1) | ||
select * from t1 where id=000000000001; | ||
id | ||
000000000001 | ||
delete from t1 where id=000000000002; | ||
select * from t1; | ||
id | ||
000000000001 | ||
drop table t1; | ||
set names latin1; | ||
SELECT 'a' = 'a '; | ||
'a' = 'a ' | ||
1 | ||
SELECT 'a\0' < 'a'; | ||
'a\0' < 'a' | ||
1 | ||
SELECT 'a\0' < 'a '; | ||
'a\0' < 'a ' | ||
1 | ||
SELECT 'a\t' < 'a'; | ||
'a\t' < 'a' | ||
1 | ||
SELECT 'a\t' < 'a '; | ||
'a\t' < 'a ' | ||
1 | ||
CREATE TABLE t1 (a char(10) not null) charset latin1; | ||
INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a '); | ||
SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1; | ||
hex(a) STRCMP(a,'a') STRCMP(a,'a ') | ||
61 0 0 | ||
6100 -1 -1 | ||
6109 -1 -1 | ||
61 0 0 | ||
DROP TABLE t1; | ||
set names default; | ||
SELECT CHAR(31) = '', '' = CHAR(31); | ||
CHAR(31) = '' '' = CHAR(31) | ||
0 0 | ||
SELECT CHAR(30) = '', '' = CHAR(30); | ||
CHAR(30) = '' '' = CHAR(30) | ||
0 0 | ||
create table t1 (a tinyint(1),b binary(1)); | ||
Warnings: | ||
Warning 1681 Integer display width is deprecated and will be removed in a future release. | ||
insert into t1 values (0x01,0x01); | ||
select * from t1 where a=b; | ||
a b | ||
Warnings: | ||
Warning 1292 Truncated incorrect DOUBLE value: '\x01' | ||
select * from t1 where a=b and b=0x01; | ||
a b | ||
Warnings: | ||
Warning 1292 Truncated incorrect DOUBLE value: '\x01' | ||
drop table if exists t1; | ||
CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill); | ||
Warnings: | ||
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. | ||
Warning 1681 Integer display width is deprecated and will be removed in a future release. | ||
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. | ||
Warning 1681 Integer display width is deprecated and will be removed in a future release. | ||
INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2); | ||
SELECT CONCAT(b,c), CONCAT(b,c) = '0101' FROM t1; | ||
CONCAT(b,c) CONCAT(b,c) = '0101' | ||
0102 0 | ||
0101 1 | ||
0202 0 | ||
analyze table t1; | ||
Table Op Msg_type Msg_text | ||
test.t1 analyze status OK | ||
EXPLAIN SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; | ||
id select_type table partitions type possible_keys key key_len ref rows filtered Extra | ||
1 SIMPLE <gather2> NULL ALL NULL NULL NULL NULL x 33.33 Parallel execute (1 workers) | ||
2 SIMPLE t1 NULL ALL NULL NULL NULL NULL x 33.33 Using where | ||
Warnings: | ||
Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 1) and (concat('01',`test`.`t1`.`c`) = '0101')) | ||
SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; | ||
b c | ||
01 01 | ||
CREATE TABLE t2 (a int); | ||
INSERT INTO t2 VALUES (1),(2); | ||
SELECT a, | ||
(SELECT COUNT(*) FROM t1 | ||
WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x | ||
FROM t2 ORDER BY a; | ||
a x | ||
1 1 | ||
2 0 | ||
analyze table t1; | ||
Table Op Msg_type Msg_text | ||
test.t1 analyze status OK | ||
analyze table t2; | ||
Table Op Msg_type Msg_text | ||
test.t2 analyze status OK | ||
EXPLAIN | ||
SELECT a, | ||
(SELECT COUNT(*) FROM t1 | ||
WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x | ||
FROM t2 ORDER BY a; | ||
id select_type table partitions type possible_keys key key_len ref rows filtered Extra | ||
1 PRIMARY t2 NULL ALL NULL NULL NULL NULL x 100.00 Using filesort | ||
2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL x 33.33 Using where | ||
Warnings: | ||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 | ||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 | ||
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,(/* select#2 */ select count(0) from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a` | ||
DROP TABLE t1,t2; | ||
SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; | ||
CREATE TABLE t1 (a TIMESTAMP); | ||
INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW()); | ||
SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00'; | ||
a | ||
DROP TABLE t1; | ||
SET sql_mode = default; | ||
End of 5.0 tests | ||
CREATE TABLE t1(a INT ZEROFILL); | ||
Warnings: | ||
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. | ||
SELECT 1 FROM t1 WHERE t1.a IN (1, t1.a) AND t1.a=2; | ||
1 | ||
DROP TABLE t1; | ||
|
||
Bug #27452148: ASSERTION FAILED: (SLEN % 4) == 0 IN | ||
MY_STRNNCOLLSP_UTF32_BIN | ||
|
||
SET NAMES latin1; | ||
CREATE TABLE t1(a CHAR(10) CHARACTER SET utf32 COLLATE utf32_bin); | ||
INSERT INTO t1 VALUES('a'),('b'),('c'); | ||
SELECT ROW('1', '1') > ROW(a, '1') FROM t1; | ||
ROW('1', '1') > ROW(a, '1') | ||
0 | ||
0 | ||
0 | ||
SELECT ROW(a, '1') > ROW('1', '1') FROM t1; | ||
ROW(a, '1') > ROW('1', '1') | ||
1 | ||
1 | ||
1 | ||
DROP TABLE t1; | ||
SET NAMES default; | ||
# | ||
# Bug#30961924 AND OF TWO PREDICATES WITH DIFFERENT COLLATION ON SAME COLUMN GIVES WRONG RESULT | ||
# | ||
CREATE TABLE t1( | ||
firstname CHAR(20), | ||
lastname CHAR(20) | ||
) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; | ||
INSERT INTO t1 VALUES("john","doe"), ("John","Doe"); | ||
SELECT * FROM t1 WHERE firstname = 'john'; | ||
firstname lastname | ||
john doe | ||
John Doe | ||
SELECT * FROM t1 WHERE firstname = 'john' COLLATE utf8mb4_0900_ai_ci; | ||
firstname lastname | ||
john doe | ||
John Doe | ||
SELECT * FROM t1 WHERE firstname = 'john' COLLATE utf8mb4_0900_as_cs; | ||
firstname lastname | ||
john doe | ||
SELECT * FROM t1 | ||
WHERE firstname = 'john' COLLATE utf8mb4_0900_ai_ci AND | ||
firstname = 'john' COLLATE utf8mb4_0900_as_cs; | ||
firstname lastname | ||
john doe | ||
SELECT * FROM t1 | ||
WHERE firstname = 'john' COLLATE utf8mb4_0900_as_cs AND | ||
firstname = 'john' COLLATE utf8mb4_0900_ai_ci; | ||
firstname lastname | ||
john doe | ||
DROP TABLE t1; | ||
Comparisons with parameters and extreme values | ||
CREATE TABLE t(a DECIMAL(30,0)); | ||
INSERT INTO t VALUES(0); | ||
SELECT * FROM t; | ||
a | ||
0 | ||
set @maxint=18446744073709551615; | ||
SELECT @maxint; | ||
@maxint | ||
18446744073709551615 | ||
SELECT * FROM t WHERE a < @maxint; | ||
a | ||
0 | ||
SELECT * FROM t WHERE a < 18446744073709551615; | ||
a | ||
0 | ||
SELECT * FROM t WHERE 0 < 18446744073709551615; | ||
a | ||
0 | ||
SELECT * FROM t WHERE 0 < @maxint; | ||
a | ||
0 | ||
DROP TABLE t; |
Oops, something went wrong.