mark some file to been opensource for ce-farm

This commit is contained in:
niyuhang
2023-11-15 11:44:43 +00:00
committed by ob-robot
parent 4900683cff
commit c8ace58297
685 changed files with 1080566 additions and 111051 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,83 @@
drop table if exists t1;
drop table if exists sbtest1;
create table t1(nr int, a longtext, b longblob);
insert into t1 values(10, repeat('a', 5000), repeat('A', 5000));
insert into t1 values(20, repeat('b', 50000), repeat('B', 50000));
insert into t1 values(30, repeat('c', 500000), repeat('C', 500000));
insert into t1 values(40, repeat('d', 3000000), repeat('D', 3000000));
insert into t1 select * from t1;
insert into t1 values(1, repeat('e', 2000000), repeat('E', 2000000));
insert into t1 select * from t1;
insert into t1 values(1, repeat('e', 2000000), repeat('E', 2000000));
insert into t1 values(2, repeat('f', 3000000), repeat('F', 3000000));
select nr, sum(length(a)), sum(length(b)), substr(a, 1000, 10), substr(b, 1000, 10), count(1) from t1 group by nr order by nr asc;
nr sum(length(a)) sum(length(b)) substr(a, 1000, 10) substr(b, 1000, 10) count(1)
1 6000000 6000000 eeeeeeeeee EEEEEEEEEE 3
2 3000000 3000000 ffffffffff FFFFFFFFFF 1
10 20000 20000 aaaaaaaaaa AAAAAAAAAA 4
20 200000 200000 bbbbbbbbbb BBBBBBBBBB 4
30 2000000 2000000 cccccccccc CCCCCCCCCC 4
40 12000000 12000000 dddddddddd DDDDDDDDDD 4
alter system major freeze tenant = sys;
alter system major freeze tenant = all_user;
alter system major freeze tenant = all_meta;
select nr, sum(length(a)), sum(length(b)), substr(a, 1000, 10), substr(b, 1000, 10), count(1) from t1 group by nr order by nr asc;
nr sum(length(a)) sum(length(b)) substr(a, 1000, 10) substr(b, 1000, 10) count(1)
1 6000000 6000000 eeeeeeeeee EEEEEEEEEE 3
2 3000000 3000000 ffffffffff FFFFFFFFFF 1
10 20000 20000 aaaaaaaaaa AAAAAAAAAA 4
20 200000 200000 bbbbbbbbbb BBBBBBBBBB 4
30 2000000 2000000 cccccccccc CCCCCCCCCC 4
40 12000000 12000000 dddddddddd DDDDDDDDDD 4
delete from t1 where nr = 2;
update t1 set a = "updated" where nr = 1;
select nr, sum(length(a)), sum(length(b)), substr(a, 1, 5), substr(b, 1000, 10), count(1) from t1 group by nr order by nr asc;
nr sum(length(a)) sum(length(b)) substr(a, 1, 5) substr(b, 1000, 10) count(1)
1 21 6000000 updat EEEEEEEEEE 3
10 20000 20000 aaaaa AAAAAAAAAA 4
20 200000 200000 bbbbb BBBBBBBBBB 4
30 2000000 2000000 ccccc CCCCCCCCCC 4
40 12000000 12000000 ddddd DDDDDDDDDD 4
alter system major freeze tenant = sys;
alter system major freeze tenant = all_user;
alter system major freeze tenant = all_meta;
select nr, sum(length(a)), sum(length(b)), substr(a, 1, 5), substr(b, 1000, 10), count(1) from t1 group by nr order by nr asc;
nr sum(length(a)) sum(length(b)) substr(a, 1, 5) substr(b, 1000, 10) count(1)
1 21 6000000 updat EEEEEEEEEE 3
10 20000 20000 aaaaa AAAAAAAAAA 4
20 200000 200000 bbbbb BBBBBBBBBB 4
30 2000000 2000000 ccccc CCCCCCCCCC 4
40 12000000 12000000 ddddd DDDDDDDDDD 4
drop table t1;
CREATE TABLE sbtest1(c1 TINYBLOB NOT NULL);
ALTER TABLE sbtest1 ADD COLUMN d int;
insert INTO sbtest1 values(NULL,10),(NULL,20),(NULL,110),(NULL,120),(NULL,100),(NULL,90);
ERROR 23000: Column 'c1' cannot be null
insert ignore INTO sbtest1 values(NULL,10),(NULL,20),(NULL,110),(NULL,120),(NULL,100),(NULL,90);
Warnings:
Warning 1048 Column 'c1' cannot be null
Warning 1048 Column 'c1' cannot be null
Warning 1048 Column 'c1' cannot be null
Warning 1048 Column 'c1' cannot be null
Warning 1048 Column 'c1' cannot be null
Warning 1048 Column 'c1' cannot be null
select * from sbtest1;
c1 d
10
20
110
120
100
90
drop table sbtest1;
create table t1(a decimal(10,0));
alter table t1 modify a varbinary(5);
INSERT INTO t1 VALUES (10);
ALTER TABLE t1 AUTO_INCREMENT=10;
ALTER TABLE t1 ADD COLUMN (c INT);
ALTER TABLE t1 ADD c2 TIME NOT NULL FIRST;
ALTER TABLE t1 ADD c4 LONGTEXT NOT NULL AFTER c2;
select * from t1;
c2 c4 a c
00:00:00 10 NULL
drop table t1;

View File

@ -0,0 +1,181 @@
drop table if exists t1, t2, t3;
create table t1(pk int, a longtext, b longblob);
create table t2(pk int, a mediumtext, b blob, c tinytext);
create table t3(pk int, a longtext);
insert into t1 values(1, repeat('a', 5000000), repeat('b', 10000000));
insert into t1 values(2, repeat('A', 5000000), repeat('B', 10000000));
insert into t2 values(1, repeat('a', 5000000), repeat('b', 60000), repeat('c', 255));
insert into t2 values(2, repeat('A', 5000000), repeat('B', 60000), repeat('C', 255));
insert into t3 values(1, repeat('a', 5000000));
insert into t3 values(1, repeat('A', 5000000));
insert into t1 values(1, repeat('a', 200000), repeat('b', 200000));
insert into t1 values(2, repeat('A', 200000), repeat('B', 200000));
insert into t2 values(1, repeat('a', 100000), repeat('b', 60000), repeat('c', 255));
insert into t2 values(2, repeat('A', 100000), repeat('B', 60000), repeat('C', 255));
insert into t3 values(1, repeat('a', 50000));
insert into t3 values(1, repeat('A', 50000));
select pk, length(a), length(b) from t1 order by 1 asc, 2;
pk length(a) length(b)
1 200000 200000
1 5000000 10000000
2 200000 200000
2 5000000 10000000
select pk, length(a), length(b), length(c) from t2 order by 1 asc, 2;
pk length(a) length(b) length(c)
1 100000 60000 255
1 5000000 60000 255
2 100000 60000 255
2 5000000 60000 255
select pk, length(a) from t3 order by 1 asc, 2;
pk length(a)
1 50000
1 50000
1 5000000
1 5000000
explain basic select * from t1 where t1.a in( select /*+ use_nl(x, y) */ x.a from t1 x, t1 y where x.pk = y.pk limit 1) order by pk asc;
Query Plan
======================================
|ID|OPERATOR |NAME |
--------------------------------------
|0 |SORT | |
|1 |└─HASH JOIN | |
|2 | ├─SUBPLAN SCAN |VIEW1|
|3 | │ └─LIMIT | |
|4 | │ └─NESTED-LOOP JOIN | |
|5 | │ ├─TABLE FULL SCAN |y |
|6 | │ └─MATERIAL | |
|7 | │ └─TABLE FULL SCAN|x |
|8 | └─TABLE FULL SCAN |t1 |
======================================
Outputs & filters:
-------------------------------------
0 - output([t1.pk], [t1.a], [t1.b]), filter(nil)
sort_keys([t1.pk, ASC])
1 - output([t1.pk], [t1.a], [t1.b]), filter(nil)
equal_conds([t1.a = VIEW1.a]), other_conds(nil)
2 - output([VIEW1.a]), filter(nil)
access([VIEW1.a])
3 - output([x.a]), filter(nil)
limit(1), offset(nil)
4 - output([x.a]), filter(nil)
conds([x.pk = y.pk]), nl_params_(nil), use_batch=false
5 - output([y.pk]), filter(nil)
access([y.pk]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([y.__pk_increment]), range(MIN ; MAX)always true
6 - output([x.a], [x.pk]), filter(nil)
7 - output([x.pk], [x.a]), filter(nil)
access([x.pk], [x.a]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([x.__pk_increment]), range(MIN ; MAX)always true
8 - output([t1.a], [t1.pk], [t1.b]), filter(nil)
access([t1.a], [t1.pk], [t1.b]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
select pk, length(a), substr(a, 1, 5), length(b), substr(b, 1, 5) from t1 where (t1.a, t1.b) in( select /*+ use_nl(x, y) */ x.a, x.b from t1 x, t1 y where x.pk = y.pk limit 1) order by pk asc;
pk length(a) substr(a, 1, 5) length(b) substr(b, 1, 5)
1 5000000 aaaaa 10000000 bbbbb
select pk, length(a), substr(a, 1, 5), length(b), substr(b, 1, 5), length(c), substr(c, 1, 5) from t2 where (t2.a, t2.b) in( select /*+ use_nl(x, y) */ x.a, x.b from t2 x, t2 y where x.pk = y.pk limit 1) order by pk asc;
pk length(a) substr(a, 1, 5) length(b) substr(b, 1, 5) length(c) substr(c, 1, 5)
1 5000000 aaaaa 60000 bbbbb 255 ccccc
select pk, length(a), substr(a, 1, 5) from t3 where t3.a in( select /*+ use_nl(x, y) */ x.a from t3 x, t3 y where x.pk = y.pk limit 1) order by pk asc;
pk length(a) substr(a, 1, 5)
1 5000000 aaaaa
1 5000000 AAAAA
explain basic select * from t1 where t1.a in( select /*+ use_hash(x, y) */ x.a from t1 x, t1 y where x.pk = y.pk limit 1) order by pk asc;
Query Plan
====================================
|ID|OPERATOR |NAME |
------------------------------------
|0 |SORT | |
|1 |└─HASH JOIN | |
|2 | ├─SUBPLAN SCAN |VIEW1|
|3 | │ └─LIMIT | |
|4 | │ └─HASH JOIN | |
|5 | │ ├─TABLE FULL SCAN|y |
|6 | │ └─TABLE FULL SCAN|x |
|7 | └─TABLE FULL SCAN |t1 |
====================================
Outputs & filters:
-------------------------------------
0 - output([t1.pk], [t1.a], [t1.b]), filter(nil)
sort_keys([t1.pk, ASC])
1 - output([t1.pk], [t1.a], [t1.b]), filter(nil)
equal_conds([t1.a = VIEW1.a]), other_conds(nil)
2 - output([VIEW1.a]), filter(nil)
access([VIEW1.a])
3 - output([x.a]), filter(nil)
limit(1), offset(nil)
4 - output([x.a]), filter(nil)
equal_conds([x.pk = y.pk]), other_conds(nil)
5 - output([y.pk]), filter(nil)
access([y.pk]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([y.__pk_increment]), range(MIN ; MAX)always true
6 - output([x.pk], [x.a]), filter(nil)
access([x.pk], [x.a]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([x.__pk_increment]), range(MIN ; MAX)always true
7 - output([t1.a], [t1.pk], [t1.b]), filter(nil)
access([t1.a], [t1.pk], [t1.b]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
select pk, length(a), substr(a, 1, 5), length(b), substr(b, 1, 5) from t1 where (t1.a, t1.b) in( select /*+ use_hash(x, y) */ x.a, x.b from t1 x, t1 y where x.pk = y.pk limit 1) order by pk asc;
pk length(a) substr(a, 1, 5) length(b) substr(b, 1, 5)
1 5000000 aaaaa 10000000 bbbbb
select pk, length(a), substr(a, 1, 5), length(b), substr(b, 1, 5), length(c), substr(c, 1, 5) from t2 where (t2.a, t2.b) in( select /*+ use_hash(x, y) */ x.a, x.b from t2 x, t2 y where x.pk = y.pk limit 1) order by pk asc;
pk length(a) substr(a, 1, 5) length(b) substr(b, 1, 5) length(c) substr(c, 1, 5)
1 5000000 aaaaa 60000 bbbbb 255 ccccc
select pk, length(a), substr(a, 1, 5) from t3 where t3.a in( select /*+ use_hash(x, y) */ x.a from t3 x, t3 y where x.pk = y.pk limit 1);
pk length(a) substr(a, 1, 5)
1 5000000 aaaaa
1 5000000 AAAAA
explain basic select pk, length(a), substr(a, 1, 5) from t1 where t1.a in( select a from t1 union select a from t2) order by pk asc;
Query Plan
====================================
|ID|OPERATOR |NAME |
------------------------------------
|0 |SORT | |
|1 |└─HASH JOIN | |
|2 | ├─TABLE FULL SCAN |t1 |
|3 | └─SUBPLAN SCAN |VIEW1|
|4 | └─HASH UNION DISTINCT| |
|5 | ├─TABLE FULL SCAN |t1 |
|6 | └─TABLE FULL SCAN |t2 |
====================================
Outputs & filters:
-------------------------------------
0 - output([t1.pk], [length(t1.a)], [substr(t1.a, 1, 5)]), filter(nil)
sort_keys([t1.pk, ASC])
1 - output([t1.pk], [t1.a]), filter(nil)
equal_conds([t1.a = VIEW1.a]), other_conds(nil)
2 - output([t1.a], [t1.pk]), filter(nil)
access([t1.a], [t1.pk]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
3 - output([VIEW1.a]), filter(nil)
access([VIEW1.a])
4 - output([UNION([1])]), filter(nil)
5 - output([t1.a]), filter(nil)
access([t1.a]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
6 - output([cast(t2.a, LONGTEXT(536870911))]), filter(nil)
access([t2.a]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([t2.__pk_increment]), range(MIN ; MAX)always true
select pk, length(a), substr(a, 1, 5) from t1 where t1.a in( select a from t1 union select a from t2) order by 1 asc,2;
pk length(a) substr(a, 1, 5)
1 200000 aaaaa
1 5000000 aaaaa
2 200000 AAAAA
2 5000000 AAAAA
select pk, length(a), substr(a, 1, 5) from t1 where t1.a in( select a from t1 except select a from t2) order by 1 asc,2;
pk length(a) substr(a, 1, 5)
1 200000 aaaaa
2 200000 AAAAA
select pk, length(a), substr(a, 1, 5) from t1 where t1.a in( select a from t1 intersect select a from t2) order by 1 asc,2;
pk length(a) substr(a, 1, 5)
1 5000000 aaaaa
2 5000000 AAAAA
drop table if exists t1, t2, t3;

View File

@ -0,0 +1,273 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
# owner: gehao.wh
# description: basic lob cast cases for mysql
# tags: text,blob
#本用例的前一部分是lob_select_mysql.test的简化,因为没有实现汇聚函数等,
# 导致无法直接运行此用例,后续补充后可以从此部分中删除
#后一部分是用有效数据做cast看来回转换是否出错
#注: mysql没有直接显式cast到lob的方法
#
# test of basic func with text/blob
#
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (nr int, a tinyblob, b text, c mediumblob, d longtext);
insert into t1 values(1, 'a', 'b', 'c', 'd');
insert into t1 values(2, 'aa', 'bb', 'cc', 'dd');
insert into t1 values(3, 'aaa', 'bbb', 'ccc', 'ddd');
insert into t1 values(4, null, null, null, null);
insert into t1 values(5, '', '', '', '');
insert into t1 values(6, 'aaa', 'BBB', 'ccc', 'DDD');
insert into t1 values(7, 'AA', 'bb', 'CC', 'dd');
select a from t1 order by nr asc;
select b from t1 order by nr asc;
select d, c from t1;
select * from t1 order by nr asc;
select * from t1 order by nr desc;
drop table t1;
#
# test of full join with text/blob
#
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (nr int(5) not null auto_increment, b text, c blob, primary key (nr));
insert into t1 values (null, "a", "A");
insert into t1 values (null, "bbb", "BBB");
insert into t1 values (null, "ccc", "CCC");
select * from t1, t1 as t2 order by t1.nr,t2.nr;
drop table t1;
#
# test of cast func with text/blob common string
#
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (nr int primary key, a1 tinyblob, a2 text, a3 mediumblob, a4 longtext);
insert into t1 values(1, 'aa', 'bb', 'cc', 'dd');
insert into t1 values(2, 'AA', 'BB', 'CC', 'DD');
insert into t1 values(3, 'aaa', '世界', 'ccc', '和平');
--let $count=1
while($count<5)
{
eval select cast(a$count AS datetime) from t1 order by nr asc;
eval select cast(a$count as decimal(9,2)) from t1 order by nr asc;
eval select cast(a$count as decimal(9)) from t1 order by nr asc;
eval select cast(a$count as binary) from t1 order by nr asc;
eval select cast(a$count as char) from t1 order by nr asc;
eval select cast(a$count as date) from t1 order by nr asc;
eval select cast(a$count as char(2)) from t1 order by nr asc;
eval select hex(cast(a$count as binary(2))) from t1 order by nr asc;
eval select cast(a$count as signed integer) from t1 order by nr asc;
eval select cast(a$count as unsigned) from t1 order by nr asc;
eval select cast(a$count as time) from t1 order by nr asc;
eval select cast(a$count as signed) from t1 order by nr asc;
eval select cast(a$count as signed) from t1 order by nr asc;
inc $count;
}
drop table t1;
create table t1(c1 blob);
insert into t1 values('123');
insert into t1 values(null);
select * from t1 where c1 is null;
select * from t1 where c1 is not null;
drop table t1;
#
# test of cast func with text, source from other types
#
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (c1 int, c2 longtext);
insert into t1 values(1, cast('2014-11-25 18:00' as datetime));
insert into t1 values(2, cast('2014-11-25' as date));
insert into t1 values(3, cast('18:00:59' as time));
# mysql does not support
# insert into t1 values(4, cast('2014-11-25 18:00' as timestamp));
insert into t1 values(4, cast('1999' as year));
insert into t1 values(5, 127);
insert into t1 values(6, 255);
insert into t1 values(7, 255);
insert into t1 values(8, 65535);
insert into t1 values(9, 18446744073709551615);
insert into t1 values(10, true);
insert into t1 values(11, b'10101');
insert into t1 values(12, 0);
insert into t1 values(13, NULL);
insert into t1 values(14, cast(3.14 as decimal(5,2)));
insert into t1 values(15, 3.14);
insert into t1 values(16, 3.14e0);
# mysql does not support
# insert into t1 values(17, cast(3.14 as numeral(5,2)));
insert into t1 values(17, cast(3.14 as double));
insert into t1 values(18, cast(3.14 as float));
insert into t1 values(19, cast('10101abcde' as binary));
insert into t1 values(20, -10000);
select * from t1;
select cast(c2 as datetime) from t1 where c1=1;
select cast(c2 as date) from t1 where c1=2;
select cast(c2 as time) from t1 where c1=3;
select cast(c2 as year) from t1 where c1=4;
select cast(c2 as signed) from t1 where c1=8;
# mysql 结果是-1 ob没有截断?
select cast(c2 as signed) from t1 where c1=9;
select cast(c2 as decimal) from t1 where c1=9;
select cast(c2 as double) from t1 where c1=17;
select cast(c2 as float) from t1 where c1=18;
select cast(c2 as binary) from t1 where c1=19;
select cast(c2 as decimal) from t1 where c1=20;
drop table t1;
#
# test of cast func with blob, source from other types
#
--disable_warnings
drop table if exists t2;
--enable_warnings
create table t2 (c1 int, c2 blob);
insert into t2 values(1, cast('2014-11-25 18:00' as datetime));
insert into t2 values(2, cast('2014-11-25' as date));
insert into t2 values(3, cast('18:00:59' as time));
# mysql does not support
# insert into t2 values(4, cast('2014-11-25 18:00' as timestamp));
insert into t2 values(4, cast('1999' as year));
insert into t2 values(5, 127);
insert into t2 values(6, 255);
insert into t2 values(7, 255);
insert into t2 values(8, 65535);
insert into t2 values(9, 18446744073709551615);
insert into t2 values(10, true);
insert into t2 values(11, b'10101');
insert into t2 values(12, 0);
insert into t2 values(13, NULL);
insert into t2 values(14, cast(3.14 as decimal(5,2)));
insert into t2 values(15, 3.14);
insert into t2 values(16, 3.14e0);
# mysql does not support
# insert into t2 values(17, cast(3.14 as numeral(5,2)));
insert into t2 values(17, cast(3.14 as double));
insert into t2 values(18, cast(3.14 as float));
insert into t2 values(19, cast('10101abcde' as binary));
insert into t2 values(20, -10000);
select * from t2;
select cast(c2 as datetime) from t2 where c1=1;
select cast(c2 as date) from t2 where c1=2;
select cast(c2 as time) from t2 where c1=3;
select cast(c2 as year) from t2 where c1=4;
select cast(c2 as signed) from t2 where c1=8;
select cast(c2 as signed) from t2 where c1=9;
select cast(c2 as decimal) from t2 where c1=9;
select cast(c2 as double) from t2 where c1=17;
select cast(c2 as float) from t2 where c1=18;
select cast(c2 as binary) from t2 where c1=19;
select cast(c2 as decimal) from t2 where c1=20;
drop table t2;
#
# test of cast func with tinytext, source from other types
#
--disable_warnings
drop table if exists t3;
--enable_warnings
create table t3 (c1 int, c2 tinytext);
insert into t3 values(1, cast('2014-11-25 18:00' as datetime));
insert into t3 values(2, cast('2014-11-25' as date));
insert into t3 values(3, cast('18:00:59' as time));
# mysql does not support
# insert into t3 values(4, cast('2014-11-25 18:00' as timestamp));
insert into t3 values(4, cast('1999' as year));
insert into t3 values(5, 127);
insert into t3 values(6, 255);
insert into t3 values(7, 255);
insert into t3 values(8, 65535);
insert into t3 values(9, 18446744073709551615);
insert into t3 values(10, true);
insert into t3 values(11, b'10101');
insert into t3 values(12, 0);
insert into t3 values(13, NULL);
insert into t3 values(14, cast(3.14 as decimal(5,2)));
insert into t3 values(15, 3.14);
insert into t3 values(16, 3.14e0);
# mysql does not support
# insert into t3 values(17, cast(3.14 as numeral(5,2)));
insert into t3 values(17, cast(3.14 as double));
insert into t3 values(18, cast(3.14 as float));
insert into t3 values(19, cast('10101abcde' as binary));
insert into t3 values(20, -10000);
select * from t3;
select cast(c2 as datetime) from t3 where c1=1;
select cast(c2 as date) from t3 where c1=2;
select cast(c2 as time) from t3 where c1=3;
select cast(c2 as year) from t3 where c1=4;
select cast(c2 as signed) from t3 where c1=8;
select cast(c2 as signed) from t3 where c1=9;
select cast(c2 as decimal) from t3 where c1=9;
select cast(c2 as double) from t3 where c1=17;
select cast(c2 as float) from t3 where c1=18;
select cast(c2 as binary) from t3 where c1=19;
select cast(c2 as decimal) from t3 where c1=20;
drop table t3;
# Notice mysql does not support cast(x as text); only cast(x as varchar), cast(x as binary)
# test outrow lobs
create table t1 (c1 int, c2 longtext);
insert into t1 values(1, repeat('abcde0123456789', 1000));
insert into t1 values(2, repeat('vwxyz0123456789', 1000));
select c2 from t1;
select cast(c2 as datetime) from t1 where c1=1;
select cast(c2 as decimal) from t1 where c1=1;
select cast(c2 as binary) from t1 where c1=1;
select cast(c2 as char) from t1 where c1=1;
select cast(c2 as date) from t1 where c1=1;
select cast(c2 as char(2)) from t1 where c1=1;
select cast(c2 as binary(2)) from t1 where c1=1;
select cast(c2 as signed integer) from t1 where c1=1;
select cast(c2 as unsigned) from t1 where c1=1;
select cast(c2 as time) from t1 where c1=1;
select cast(c2 as signed) from t1 where c1=1;
drop table t1;
# test outrow lobs
create table t1 (c1 int, c2 longtext, c3 longtext);
insert into t1 values(1, repeat('abcde0123456789', 1000), repeat('vwxyz0123456789', 1000));
insert into t1 values(2, repeat('abcde0123456789', 1000), repeat('abcde0123456789', 1000));
select c2 > c3 from t1 where c1=1;
select c2 < c3 from t1 where c1=1;
select c2 = c3 from t1 where c1=1;
select c2 > c3 from t1 where c1=2;
select c2 < c3 from t1 where c1=2;
select c2 = c3 from t1 where c1=2;
drop table t1;
CREATE TABLE t1 (c1 tinyblob DEFAULT NULL, c2 varchar(161) DEFAULT 's&7dcwZ3nSn~E(O', c3 text NOT NULL);
(select nvl( c1 , c2 ) as c from t1) union all (select lower(c3) as c from t1);
drop table t1;

View File

@ -0,0 +1,79 @@
# owner: luohongdi.lhd
# owner group: SQL1
# description: test for blob and text column after daily merge
# tags: text,blob
# temporarily disable large row
--disable_query_log
set global max_allowed_packet=60000000;
set global ob_sql_work_area_percentage=90;
disconnect default;
sleep 1;
connect (default,$OBMYSQL_MS0,admin@mysql,admin,test,$OBMYSQL_PORT);
set @@session.explicit_defaults_for_timestamp=off;
set @@recyclebin = off;
set ob_query_timeout=1000000000;
set ob_trx_timeout=1000000000;
--enable_query_log
#
# bug
#
--disable_warnings
drop table if exists t1;
drop table if exists sbtest1;
--enable_warnings
create table t1(nr int, a longtext, b longblob);
insert into t1 values(10, repeat('a', 5000), repeat('A', 5000));
insert into t1 values(20, repeat('b', 50000), repeat('B', 50000));
insert into t1 values(30, repeat('c', 500000), repeat('C', 500000));
insert into t1 values(40, repeat('d', 3000000), repeat('D', 3000000));
--let $loop=2
while($loop > 0)
{
insert into t1 select * from t1;
insert into t1 values(1, repeat('e', 2000000), repeat('E', 2000000));
dec $loop;
}
insert into t1 values(2, repeat('f', 3000000), repeat('F', 3000000));
select nr, sum(length(a)), sum(length(b)), substr(a, 1000, 10), substr(b, 1000, 10), count(1) from t1 group by nr order by nr asc;
--source mysql_test/include/majorfreeze.inc
--source mysql_test/include/wait_daily_merge.inc
connection default;
select nr, sum(length(a)), sum(length(b)), substr(a, 1000, 10), substr(b, 1000, 10), count(1) from t1 group by nr order by nr asc;
delete from t1 where nr = 2;
update t1 set a = "updated" where nr = 1;
select nr, sum(length(a)), sum(length(b)), substr(a, 1, 5), substr(b, 1000, 10), count(1) from t1 group by nr order by nr asc;
--source mysql_test/include/majorfreeze.inc
--source mysql_test/include/wait_daily_merge.inc
connection default;
select nr, sum(length(a)), sum(length(b)), substr(a, 1, 5), substr(b, 1000, 10), count(1) from t1 group by nr order by nr asc;
drop table t1;
## bugfix#
CREATE TABLE sbtest1(c1 TINYBLOB NOT NULL);
ALTER TABLE sbtest1 ADD COLUMN d int;
--error 1048
insert INTO sbtest1 values(NULL,10),(NULL,20),(NULL,110),(NULL,120),(NULL,100),(NULL,90);
insert ignore INTO sbtest1 values(NULL,10),(NULL,20),(NULL,110),(NULL,120),(NULL,100),(NULL,90);
select * from sbtest1;
drop table sbtest1;
--disable_query_log
set global max_allowed_packet=16777216;
set global ob_sql_work_area_percentage=5;
--enable_query_log
## bugfix#
create table t1(a decimal(10,0));
alter table t1 modify a varbinary(5);
INSERT INTO t1 VALUES (10);
ALTER TABLE t1 AUTO_INCREMENT=10;
ALTER TABLE t1 ADD COLUMN (c INT);
ALTER TABLE t1 ADD c2 TIME NOT NULL FIRST;
ALTER TABLE t1 ADD c4 LONGTEXT NOT NULL AFTER c2;
select * from t1;
drop table t1;

View File

@ -0,0 +1,79 @@
#owner: luohongdi.lhd
#owner group: sql2
# tags: optimizer
--disable_query_log
set global max_allowed_packet=60000000;
set global ob_sql_work_area_percentage=90;
disconnect default;
sleep 1;
connect (default,$OBMYSQL_MS0,admin@mysql,admin,test,$OBMYSQL_PORT);
set @@session.explicit_defaults_for_timestamp=off;
set @@recyclebin = off;
set ob_query_timeout=1000000000;
set ob_trx_timeout=1000000000;
--enable_query_log
--disable_warnings
drop table if exists t1, t2, t3;
--enable_warnings
create table t1(pk int, a longtext, b longblob);
create table t2(pk int, a mediumtext, b blob, c tinytext);
create table t3(pk int, a longtext);
insert into t1 values(1, repeat('a', 5000000), repeat('b', 10000000));
insert into t1 values(2, repeat('A', 5000000), repeat('B', 10000000));
insert into t2 values(1, repeat('a', 5000000), repeat('b', 60000), repeat('c', 255));
insert into t2 values(2, repeat('A', 5000000), repeat('B', 60000), repeat('C', 255));
insert into t3 values(1, repeat('a', 5000000));
insert into t3 values(1, repeat('A', 5000000));
insert into t1 values(1, repeat('a', 200000), repeat('b', 200000));
insert into t1 values(2, repeat('A', 200000), repeat('B', 200000));
insert into t2 values(1, repeat('a', 100000), repeat('b', 60000), repeat('c', 255));
insert into t2 values(2, repeat('A', 100000), repeat('B', 60000), repeat('C', 255));
insert into t3 values(1, repeat('a', 50000));
insert into t3 values(1, repeat('A', 50000));
select pk, length(a), length(b) from t1 order by 1 asc, 2;
select pk, length(a), length(b), length(c) from t2 order by 1 asc, 2;
select pk, length(a) from t3 order by 1 asc, 2;
#intermediate from order by
#explain basic select pk, length(a), substr(a, 1, 5), length(b), substr(b, 1, 5) from t1 where (t1.a, t1.b) in( select a,b from t1 order by pk desc limit 1) order by pk asc;
#select pk, length(a), substr(a, 1, 5), length(b), substr(b, 1, 5) from t1 where (t1.a, t1.b) in( select a,b from t1 order by pk desc limit 1) order by pk asc;
#select pk, length(a), substr(a, 1, 5), length(b), substr(b, 1, 5), length(c), substr(c, 1, 5) from t2 where (t2.a, t2.b, t2.c) in( select a,b,c from t2 order by pk desc limit 1) order by pk asc;
#select pk, length(a), substr(a, 1, 5) from t3 where t3.a in( select a from t3 order by pk desc limit 1) order by pk asc;
#intermediate from nestloop join
explain basic select * from t1 where t1.a in( select /*+ use_nl(x, y) */ x.a from t1 x, t1 y where x.pk = y.pk limit 1) order by pk asc;
select pk, length(a), substr(a, 1, 5), length(b), substr(b, 1, 5) from t1 where (t1.a, t1.b) in( select /*+ use_nl(x, y) */ x.a, x.b from t1 x, t1 y where x.pk = y.pk limit 1) order by pk asc;
select pk, length(a), substr(a, 1, 5), length(b), substr(b, 1, 5), length(c), substr(c, 1, 5) from t2 where (t2.a, t2.b) in( select /*+ use_nl(x, y) */ x.a, x.b from t2 x, t2 y where x.pk = y.pk limit 1) order by pk asc;
select pk, length(a), substr(a, 1, 5) from t3 where t3.a in( select /*+ use_nl(x, y) */ x.a from t3 x, t3 y where x.pk = y.pk limit 1) order by pk asc;
#intermediate from merge join
#explain basic select * from t1 where t1.a in( select /*+ use_merge(x, y) */ x.a from t1 x, t1 y where x.pk = y.pk limit 1) order by pk asc;
#select pk, length(a), substr(a, 1, 5), length(b), substr(b, 1, 5) from t1 where (t1.a, t1.b) in( select /*+ use_merge(x, y) */ x.a, x.b from t1 x, t1 y where x.pk = y.pk limit 1) order by pk asc;
#select pk, length(a), substr(a, 1, 5), length(b), substr(b, 1, 5), length(c), substr(c, 1, 5) from t2 where (t2.a, t2.b) in( select /*+ use_merge(x, y) */ x.a, x.b from t2 x, t2 y where x.pk = y.pk limit 1) order by pk asc;
#select pk, length(a), substr(a, 1, 5) from t3 where t3.a in( select /*+ use_merge(x, y) */ x.a from t3 x, t3 y where x.pk = y.pk limit 1) order by pk asc;
#intermediate from hash join
explain basic select * from t1 where t1.a in( select /*+ use_hash(x, y) */ x.a from t1 x, t1 y where x.pk = y.pk limit 1) order by pk asc;
select pk, length(a), substr(a, 1, 5), length(b), substr(b, 1, 5) from t1 where (t1.a, t1.b) in( select /*+ use_hash(x, y) */ x.a, x.b from t1 x, t1 y where x.pk = y.pk limit 1) order by pk asc;
select pk, length(a), substr(a, 1, 5), length(b), substr(b, 1, 5), length(c), substr(c, 1, 5) from t2 where (t2.a, t2.b) in( select /*+ use_hash(x, y) */ x.a, x.b from t2 x, t2 y where x.pk = y.pk limit 1) order by pk asc;
select pk, length(a), substr(a, 1, 5) from t3 where t3.a in( select /*+ use_hash(x, y) */ x.a from t3 x, t3 y where x.pk = y.pk limit 1);
#intermediate from set
explain basic select pk, length(a), substr(a, 1, 5) from t1 where t1.a in( select a from t1 union select a from t2) order by pk asc;
select pk, length(a), substr(a, 1, 5) from t1 where t1.a in( select a from t1 union select a from t2) order by 1 asc,2;
select pk, length(a), substr(a, 1, 5) from t1 where t1.a in( select a from t1 except select a from t2) order by 1 asc,2;
select pk, length(a), substr(a, 1, 5) from t1 where t1.a in( select a from t1 intersect select a from t2) order by 1 asc,2;
#cleanup
--disable_warnings
drop table if exists t1, t2, t3;
--enable_warnings
--disable_query_log
set global max_allowed_packet=16777216;
set global ob_sql_work_area_percentage=5;
--enable_query_log