init push
This commit is contained in:
@ -0,0 +1,261 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
drop database if exists shaoge;
|
||||
drop table if exists t1;
|
||||
create database shaoge;
|
||||
use shaoge;
|
||||
create table t1(col_float float, col_char char(100), col_text text);
|
||||
insert into t1 values (1.1, '1.1', '1.1');
|
||||
insert into t1 values (1.9, '1.9', '1.9');
|
||||
insert into t1 values (2.1, '2.1', '2.1');
|
||||
insert into t1 values (2.9, '2.9', '2.9');
|
||||
insert into t1 values (9223372036854775807, '9223372036854775807', '9223372036854775807');
|
||||
insert into t1 values (9223372036854775807.5, '9223372036854775807.5', '9223372036854775807.5');
|
||||
insert into t1 values (9223372036854775806.5, '9223372036854775806.5', '9223372036854775806.5');
|
||||
insert into t1 values (null, '1234567890123456789012345678901234567890.5', '1234567890123456789012345678901234567890.5');
|
||||
insert into t1 values (-1.1, '-1.1', '-1.1');
|
||||
insert into t1 values (-1.9, '-1.9', '-1.9');
|
||||
insert into t1 values (-2.1, '-2.1', '-2.1');
|
||||
insert into t1 values (-2.9, '-2.9', '-2.9');
|
||||
insert into t1 values (-9223372036854775807, '-9223372036854775808', '-9223372036854775808');
|
||||
insert into t1 values (-9223372036854775807.5, '-9223372036854775807.5', '-9223372036854775807.5');
|
||||
insert into t1 values (-9223372036854775806.5, '-9223372036854775806.5', '-9223372036854775806.5');
|
||||
insert into t1 values (null, '-1234567890123456789012345678901234567890.5', '-1234567890123456789012345678901234567890.5');
|
||||
create table tbl_check_zerofill(col_zf int(3) zerofill, col_no_zf int(3));
|
||||
insert into tbl_check_zerofill values(1, 1);
|
||||
// sql engine 3.0 test
|
||||
// string->int/uint will trunc
|
||||
// otherwise will round
|
||||
select col_float, cast(col_float as signed) from t1;
|
||||
col_float cast(col_float as signed)
|
||||
1.1 1
|
||||
1.9 2
|
||||
2.1 2
|
||||
2.9 3
|
||||
9.22337e18 -9223372036854775808
|
||||
9.22337e18 -9223372036854775808
|
||||
9.22337e18 -9223372036854775808
|
||||
NULL NULL
|
||||
-1.1 -1
|
||||
-1.9 -2
|
||||
-2.1 -2
|
||||
-2.9 -3
|
||||
-9.22337e18 -9223372036854775808
|
||||
-9.22337e18 -9223372036854775808
|
||||
-9.22337e18 -9223372036854775808
|
||||
NULL NULL
|
||||
select col_char, cast(col_char as signed) from t1;
|
||||
col_char cast(col_char as signed)
|
||||
1.1 1
|
||||
1.9 1
|
||||
2.1 2
|
||||
2.9 2
|
||||
9223372036854775807 9223372036854775807
|
||||
9223372036854775807.5 9223372036854775807
|
||||
9223372036854775806.5 9223372036854775806
|
||||
1234567890123456789012345678901234567890.5 9223372036854775807
|
||||
-1.1 -1
|
||||
-1.9 -1
|
||||
-2.1 -2
|
||||
-2.9 -2
|
||||
-9223372036854775808 -9223372036854775808
|
||||
-9223372036854775807.5 -9223372036854775807
|
||||
-9223372036854775806.5 -9223372036854775806
|
||||
-1234567890123456789012345678901234567890.5 -9223372036854775808
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775806.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775806.5'
|
||||
select col_text, cast(col_text as signed) from t1;
|
||||
col_text cast(col_text as signed)
|
||||
1.1 1
|
||||
1.9 1
|
||||
2.1 2
|
||||
2.9 2
|
||||
9223372036854775807 9223372036854775807
|
||||
9223372036854775807.5 9223372036854775807
|
||||
9223372036854775806.5 9223372036854775806
|
||||
1234567890123456789012345678901234567890.5 9223372036854775807
|
||||
-1.1 -1
|
||||
-1.9 -1
|
||||
-2.1 -2
|
||||
-2.9 -2
|
||||
-9223372036854775808 -9223372036854775808
|
||||
-9223372036854775807.5 -9223372036854775807
|
||||
-9223372036854775806.5 -9223372036854775806
|
||||
-1234567890123456789012345678901234567890.5 -9223372036854775808
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775806.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775806.5'
|
||||
select col_float, cast(col_float as unsigned) from t1;
|
||||
col_float cast(col_float as unsigned)
|
||||
1.1 1
|
||||
1.9 2
|
||||
2.1 2
|
||||
2.9 3
|
||||
9.22337e18 9223372036854775808
|
||||
9.22337e18 9223372036854775808
|
||||
9.22337e18 9223372036854775808
|
||||
NULL NULL
|
||||
-1.1 18446744073709551615
|
||||
-1.9 18446744073709551614
|
||||
-2.1 18446744073709551614
|
||||
-2.9 18446744073709551613
|
||||
-9.22337e18 9223372036854775808
|
||||
-9.22337e18 9223372036854775808
|
||||
-9.22337e18 9223372036854775808
|
||||
NULL NULL
|
||||
select col_char, cast(col_char as unsigned) from t1;
|
||||
col_char cast(col_char as unsigned)
|
||||
1.1 1
|
||||
1.9 1
|
||||
2.1 2
|
||||
2.9 2
|
||||
9223372036854775807 9223372036854775807
|
||||
9223372036854775807.5 9223372036854775807
|
||||
9223372036854775806.5 9223372036854775806
|
||||
1234567890123456789012345678901234567890.5 18446744073709551615
|
||||
-1.1 18446744073709551615
|
||||
-1.9 18446744073709551615
|
||||
-2.1 18446744073709551614
|
||||
-2.9 18446744073709551614
|
||||
-9223372036854775808 9223372036854775808
|
||||
-9223372036854775807.5 9223372036854775809
|
||||
-9223372036854775806.5 9223372036854775810
|
||||
-1234567890123456789012345678901234567890.5 18446744073709551615
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775806.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1234567890123456789012345678901234567890.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775806.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1234567890123456789012345678901234567890.5'
|
||||
select col_text, cast(col_text as unsigned) from t1;
|
||||
col_text cast(col_text as unsigned)
|
||||
1.1 1
|
||||
1.9 1
|
||||
2.1 2
|
||||
2.9 2
|
||||
9223372036854775807 9223372036854775807
|
||||
9223372036854775807.5 9223372036854775807
|
||||
9223372036854775806.5 9223372036854775806
|
||||
1234567890123456789012345678901234567890.5 18446744073709551615
|
||||
-1.1 18446744073709551615
|
||||
-1.9 18446744073709551615
|
||||
-2.1 18446744073709551614
|
||||
-2.9 18446744073709551614
|
||||
-9223372036854775808 9223372036854775808
|
||||
-9223372036854775807.5 9223372036854775809
|
||||
-9223372036854775806.5 9223372036854775810
|
||||
-1234567890123456789012345678901234567890.5 18446744073709551615
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775806.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1234567890123456789012345678901234567890.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775806.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1234567890123456789012345678901234567890.5'
|
||||
// 测试zerofill
|
||||
// 应该有warning: Truncated incorrect CHAR(1) value: '001'
|
||||
select cast(col_zf as char(1)) from tbl_check_zerofill;
|
||||
cast(col_zf as char(1))
|
||||
0
|
||||
select cast(col_zf as char(2)) from tbl_check_zerofill;
|
||||
cast(col_zf as char(2))
|
||||
00
|
||||
select cast(col_zf as char(3)) from tbl_check_zerofill;
|
||||
cast(col_zf as char(3))
|
||||
001
|
||||
select cast(col_zf as char(4)) from tbl_check_zerofill;
|
||||
cast(col_zf as char(4))
|
||||
001
|
||||
select cast(col_no_zf as char(1)) from tbl_check_zerofill;
|
||||
cast(col_no_zf as char(1))
|
||||
1
|
||||
select cast(col_no_zf as char(1)) from tbl_check_zerofill;
|
||||
cast(col_no_zf as char(1))
|
||||
1
|
||||
select cast(col_no_zf as char(2)) from tbl_check_zerofill;
|
||||
cast(col_no_zf as char(2))
|
||||
1
|
||||
select cast(col_no_zf as char(3)) from tbl_check_zerofill;
|
||||
cast(col_no_zf as char(3))
|
||||
1
|
||||
select cast(col_no_zf as char(4)) from tbl_check_zerofill;
|
||||
cast(col_no_zf as char(4))
|
||||
1
|
||||
drop table t1;
|
||||
create table t1(c1 varchar(3));
|
||||
insert into t1 values('abc');
|
||||
select cast(c1 as char(10)), concat(c1, '123') from t1;
|
||||
cast(c1 as char(10)) concat(c1, '123')
|
||||
abc abc123
|
||||
select cast(c1 as char(1)), concat(c1, '123') from t1;
|
||||
cast(c1 as char(1)) concat(c1, '123')
|
||||
a abc123
|
||||
select concat(cast(c1 as char(10)), '123') from t1;
|
||||
concat(cast(c1 as char(10)), '123')
|
||||
abc123
|
||||
select concat(cast(c1 as char(1)), '123') from t1;
|
||||
concat(cast(c1 as char(1)), '123')
|
||||
a123
|
||||
drop table t1;
|
||||
create table t1(c1 decimal(10, 3));
|
||||
insert into t1 values(1.123);
|
||||
select cast(c1 as decimal(10,1)), concat(c1, 'abc') from t1;
|
||||
cast(c1 as decimal(10,1)) concat(c1, 'abc')
|
||||
1.1 1.123abc
|
||||
select c1, cast(c1 as binary(10)), hex(cast(c1 as binary(10))) from t1;
|
||||
c1 cast(c1 as binary(10)) hex(cast(c1 as binary(10)))
|
||||
1.123 1.123 312E3132330000000000
|
||||
drop table t1;
|
||||
create table t1(c1 time(6));
|
||||
insert into t1 values('11:11:11.123456');
|
||||
select cast(c1 as time), concat(c1, 'abc') from t1;
|
||||
cast(c1 as time) concat(c1, 'abc')
|
||||
11:11:11 11:11:11.123456abc
|
||||
drop table t1;
|
||||
create table t1(c1 bigint unsigned);
|
||||
insert into t1 values(18446744073709551615);
|
||||
select cast(c1 as signed) from t1;
|
||||
cast(c1 as signed)
|
||||
-1
|
||||
select c1, cast(c1 as binary(30)), hex(cast(c1 as binary(30))) from t1;
|
||||
c1 cast(c1 as binary(30)) hex(cast(c1 as binary(30)))
|
||||
18446744073709551615 18446744073709551615 313834343637343430373337303935353136313500000000000000000000
|
||||
drop table t1;
|
||||
720
test/mysql_test/test_suite/static_engine/r/mysql/expr_abs.result
Normal file
720
test/mysql_test/test_suite/static_engine/r/mysql/expr_abs.result
Normal file
@ -0,0 +1,720 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
connection default;
|
||||
drop table if exists t;
|
||||
create table t (t1 tinyint,
|
||||
t2 smallint,
|
||||
t3 mediumint,
|
||||
t4 integer,
|
||||
t5 bigint,
|
||||
t6 tinyint unsigned,
|
||||
t7 smallint unsigned,
|
||||
t8 mediumint unsigned,
|
||||
t9 integer unsigned,
|
||||
t10 bigint unsigned,
|
||||
t11 float,
|
||||
t12 float unsigned,
|
||||
t13 double,
|
||||
t14 double unsigned,
|
||||
t15 number,
|
||||
t16 number unsigned,
|
||||
t17 datetime,
|
||||
t18 timestamp,
|
||||
t19 date,
|
||||
t20 time,
|
||||
t21 year,
|
||||
t22 varchar(255),
|
||||
t23 char(255),
|
||||
t24 tinytext,
|
||||
t25 mediumtext,
|
||||
t26 longtext,
|
||||
t27 bit,
|
||||
t28 enum('a', 'b', 'c'),
|
||||
t29 set('a', 'b', 'c'));
|
||||
insert into t values (1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -0.2, 0.3, 0.4, 0.5, -0.6, 0.7,
|
||||
'1993-03-20', '1993-03-20', '1993-03-20', '10:10:10', '1993', '0.8', '0.9', '1.0', '1.1',
|
||||
'1.2', 1, 'b', 'b');
|
||||
insert into t(t1) values (null);
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
connection default;
|
||||
set ob_enable_plan_cache=false;
|
||||
select abs(1.0);
|
||||
abs(1.0)
|
||||
1.0
|
||||
explain select abs(1.0);
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([?]), filter(nil)
|
||||
values({?})
|
||||
|
||||
select abs(1);
|
||||
abs(1)
|
||||
1
|
||||
explain select abs(1);
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([?]), filter(nil)
|
||||
values({?})
|
||||
|
||||
select abs(1+2+3-4-1-2+5-5);
|
||||
abs(1+2+3-4-1-2+5-5)
|
||||
1
|
||||
explain select abs(1+2+3-4-1-2+5-5);
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([?]), filter(nil)
|
||||
values({?})
|
||||
|
||||
select abs(abs(1+2+3-4-1-2+5-5)-abs(-3));
|
||||
abs(abs(1+2+3-4-1-2+5-5)-abs(-3))
|
||||
2
|
||||
explain select abs(abs(1+2+3-4-1-2+5-5)-abs(-3));
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([?]), filter(nil)
|
||||
values({?})
|
||||
|
||||
select abs(true and false);
|
||||
abs(true and false)
|
||||
0
|
||||
explain select abs(true and false);
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([?]), filter(nil)
|
||||
values({?})
|
||||
|
||||
select abs(10/0);
|
||||
abs(10/0)
|
||||
NULL
|
||||
SELECT ABS(-9223372036854775808);
|
||||
ERROR 22003: value is out of range
|
||||
explain SELECT ABS(-9223372036854775808);
|
||||
ERROR 22003: value is out of range
|
||||
select abs(-9999999999999999999999);
|
||||
abs(-9999999999999999999999)
|
||||
9999999999999999999999
|
||||
explain select abs(-9999999999999999999999);
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([?]), filter(nil)
|
||||
values({?})
|
||||
|
||||
select abs(9999999999999999999999);
|
||||
abs(9999999999999999999999)
|
||||
9999999999999999999999
|
||||
explain select abs(9999999999999999999999);
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([?]), filter(nil)
|
||||
values({?})
|
||||
|
||||
select abs(repeat('1',100));
|
||||
abs(repeat('1',100))
|
||||
1.111111111111111e99
|
||||
explain select abs(repeat('1',100));
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([?]), filter(nil)
|
||||
values({?})
|
||||
|
||||
select abs(repeat('1',46));
|
||||
abs(repeat('1',46))
|
||||
1.1111111111111112e45
|
||||
explain select abs(repeat('1',46));
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([?]), filter(nil)
|
||||
values({?})
|
||||
|
||||
select abs(0-repeat('1',46));
|
||||
abs(0-repeat('1',46))
|
||||
1.1111111111111112e45
|
||||
explain select abs(0-repeat('1',46));
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([?]), filter(nil)
|
||||
values({?})
|
||||
|
||||
select abs(t1) from t;
|
||||
abs(t1)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t1) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t1, BIGINT(-1, 0)))]), filter(nil),
|
||||
access([t.t1]), partitions(p0)
|
||||
|
||||
select abs(t2) from t;
|
||||
abs(t2)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t2) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t2, BIGINT(-1, 0)))]), filter(nil),
|
||||
access([t.t2]), partitions(p0)
|
||||
|
||||
select abs(t3) from t;
|
||||
abs(t3)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t3) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t3, BIGINT(-1, 0)))]), filter(nil),
|
||||
access([t.t3]), partitions(p0)
|
||||
|
||||
select abs(t4) from t;
|
||||
abs(t4)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t4) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t4, BIGINT(-1, 0)))]), filter(nil),
|
||||
access([t.t4]), partitions(p0)
|
||||
|
||||
select abs(t5) from t;
|
||||
abs(t5)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t5) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(t.t5)]), filter(nil),
|
||||
access([t.t5]), partitions(p0)
|
||||
|
||||
select abs(t6) from t;
|
||||
abs(t6)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t6) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t6, BIGINT UNSIGNED(-1, 0)))]), filter(nil),
|
||||
access([t.t6]), partitions(p0)
|
||||
|
||||
select abs(t7) from t;
|
||||
abs(t7)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t7) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t7, BIGINT UNSIGNED(-1, 0)))]), filter(nil),
|
||||
access([t.t7]), partitions(p0)
|
||||
|
||||
select abs(t8) from t;
|
||||
abs(t8)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t8) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t8, BIGINT UNSIGNED(-1, 0)))]), filter(nil),
|
||||
access([t.t8]), partitions(p0)
|
||||
|
||||
select abs(t9) from t;
|
||||
abs(t9)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t9) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t9, BIGINT UNSIGNED(-1, 0)))]), filter(nil),
|
||||
access([t.t9]), partitions(p0)
|
||||
|
||||
select abs(t10) from t;
|
||||
abs(t10)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t10) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(t.t10)]), filter(nil),
|
||||
access([t.t10]), partitions(p0)
|
||||
|
||||
select abs(t11) from t;
|
||||
abs(t11)
|
||||
0.20000000298023224
|
||||
NULL
|
||||
explain select abs(t11) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t11, DOUBLE(-1, -1)))]), filter(nil),
|
||||
access([t.t11]), partitions(p0)
|
||||
|
||||
select abs(t12) from t;
|
||||
abs(t12)
|
||||
0.30000001192092896
|
||||
NULL
|
||||
explain select abs(t12) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t12, DOUBLE UNSIGNED(-1, -1)))]), filter(nil),
|
||||
access([t.t12]), partitions(p0)
|
||||
|
||||
select abs(t13) from t;
|
||||
abs(t13)
|
||||
0.4
|
||||
NULL
|
||||
explain select abs(t13) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(t.t13)]), filter(nil),
|
||||
access([t.t13]), partitions(p0)
|
||||
|
||||
select abs(t14) from t;
|
||||
abs(t14)
|
||||
0.5
|
||||
NULL
|
||||
explain select abs(t14) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(t.t14)]), filter(nil),
|
||||
access([t.t14]), partitions(p0)
|
||||
|
||||
select abs(t15) from t;
|
||||
abs(t15)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t15) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(t.t15)]), filter(nil),
|
||||
access([t.t15]), partitions(p0)
|
||||
|
||||
select abs(t16) from t;
|
||||
abs(t16)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t16) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(t.t16)]), filter(nil),
|
||||
access([t.t16]), partitions(p0)
|
||||
|
||||
select abs(t17) from t;
|
||||
abs(t17)
|
||||
19930320000000
|
||||
NULL
|
||||
explain select abs(t17) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t17, DOUBLE(-1, -1)))]), filter(nil),
|
||||
access([t.t17]), partitions(p0)
|
||||
|
||||
select abs(t18) from t;
|
||||
abs(t18)
|
||||
19930320000000
|
||||
NULL
|
||||
explain select abs(t18) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t18, DOUBLE(-1, -1)))]), filter(nil),
|
||||
access([t.t18]), partitions(p0)
|
||||
|
||||
select abs(t19) from t;
|
||||
abs(t19)
|
||||
19930320
|
||||
NULL
|
||||
explain select abs(t19) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t19, DOUBLE(-1, -1)))]), filter(nil),
|
||||
access([t.t19]), partitions(p0)
|
||||
|
||||
select abs(t20) from t;
|
||||
abs(t20)
|
||||
101010
|
||||
NULL
|
||||
explain select abs(t20) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t20, DOUBLE(-1, -1)))]), filter(nil),
|
||||
access([t.t20]), partitions(p0)
|
||||
|
||||
select abs(t21) from t;
|
||||
abs(t21)
|
||||
1993
|
||||
NULL
|
||||
explain select abs(t21) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t21, BIGINT UNSIGNED(-1, 0)))]), filter(nil),
|
||||
access([t.t21]), partitions(p0)
|
||||
|
||||
select abs(t22) from t;
|
||||
abs(t22)
|
||||
0.8
|
||||
NULL
|
||||
explain select abs(t22) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t22, DOUBLE(-1, -1)))]), filter(nil),
|
||||
access([t.t22]), partitions(p0)
|
||||
|
||||
select abs(t23) from t;
|
||||
abs(t23)
|
||||
0.9
|
||||
NULL
|
||||
explain select abs(t23) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t23, DOUBLE(-1, -1)))]), filter(nil),
|
||||
access([t.t23]), partitions(p0)
|
||||
|
||||
select abs(t24) from t;
|
||||
abs(t24)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t24) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t24, DOUBLE(-1, -1)))]), filter(nil),
|
||||
access([t.t24]), partitions(p0)
|
||||
|
||||
select abs(t25) from t;
|
||||
abs(t25)
|
||||
1.1
|
||||
NULL
|
||||
explain select abs(t25) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t25, DOUBLE(-1, -1)))]), filter(nil),
|
||||
access([t.t25]), partitions(p0)
|
||||
|
||||
select abs(t26) from t;
|
||||
abs(t26)
|
||||
1.2
|
||||
NULL
|
||||
explain select abs(t26) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t26, DOUBLE(-1, -1)))]), filter(nil),
|
||||
access([t.t26]), partitions(p0)
|
||||
|
||||
select abs(t27) from t;
|
||||
abs(t27)
|
||||
1
|
||||
NULL
|
||||
explain select abs(t27) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t27, BIGINT UNSIGNED(-1, 0)))]), filter(nil),
|
||||
access([t.t27]), partitions(p0)
|
||||
|
||||
select abs(t28) from t;
|
||||
abs(t28)
|
||||
2
|
||||
NULL
|
||||
explain select abs(t28) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t28, DOUBLE(-1, -1)))]), filter(nil),
|
||||
access([t.t28]), partitions(p0)
|
||||
|
||||
select abs(t29) from t;
|
||||
abs(t29)
|
||||
2
|
||||
NULL
|
||||
explain select abs(t29) from t;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |2 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([abs(cast(t.t29, DOUBLE(-1, -1)))]), filter(nil),
|
||||
access([t.t29]), partitions(p0)
|
||||
|
||||
drop table if exists t1;
|
||||
create table t1(c1 decimal unsigned, c2 smallint unsigned);
|
||||
insert into t1 values(1, 1);
|
||||
select mod(round(abs(c1)), c2) from t1;
|
||||
mod(round(abs(c1)), c2)
|
||||
0
|
||||
drop table t1;
|
||||
// abs(hex_string)
|
||||
select abs(X'31');
|
||||
abs(X'31')
|
||||
49
|
||||
select abs(binary'-100');
|
||||
abs(binary'-100')
|
||||
100
|
||||
select abs(_utf8'-100');
|
||||
abs(_utf8'-100')
|
||||
100
|
||||
connection conn_admin;
|
||||
@ -0,0 +1,314 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
set ob_enable_plan_cache = 0;
|
||||
drop table if exists t1;
|
||||
create table t1(col_int int,
|
||||
col_zero int,
|
||||
col_null int,
|
||||
col_varchar varchar(100),
|
||||
col_varchar_num varchar(100),
|
||||
col_empty_str varchar(100),
|
||||
col_varchar_zero varchar(100));
|
||||
insert into t1 values(1, 0, null, 'abc', '1', '', '0');
|
||||
// Case1: normal test
|
||||
// Case1.1: int test
|
||||
// bool expr exists, no cast expr, res is NULL
|
||||
select col_int and col_null from t1;
|
||||
col_int and col_null
|
||||
NULL
|
||||
// same as above
|
||||
select col_null and col_int from t1;
|
||||
col_null and col_int
|
||||
NULL
|
||||
// bool expr exists for col_varchar, cast expr exists, res is 0
|
||||
select col_int and col_varchar from t1;
|
||||
col_int and col_varchar
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
// same as above
|
||||
select col_varchar and col_int from t1;
|
||||
col_varchar and col_int
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
// bool expr and cast expr exists for col_varchar_num, res is 0
|
||||
select col_int and col_varchar_num from t1;
|
||||
col_int and col_varchar_num
|
||||
1
|
||||
// same as above
|
||||
select col_varchar_num and col_int from t1;
|
||||
col_varchar_num and col_int
|
||||
1
|
||||
// bool expr exists, no cast expr, res is 0
|
||||
select col_int and 0 from t1;
|
||||
col_int and 0
|
||||
0
|
||||
// same as above
|
||||
select 0 and col_int from t1;
|
||||
0 and col_int
|
||||
0
|
||||
// Case1.1: null test
|
||||
// bool expr exists, no cast expr, res is NULL
|
||||
select col_null and col_null from t1;
|
||||
col_null and col_null
|
||||
NULL
|
||||
// bool expr and cast expr exists for col_varchar_num, res is NULL
|
||||
select col_null and col_varchar_num from t1;
|
||||
col_null and col_varchar_num
|
||||
NULL
|
||||
// same as above
|
||||
select col_varchar_num and col_null from t1;
|
||||
col_varchar_num and col_null
|
||||
NULL
|
||||
// bool expr and cast expr exists for col_varchar_num, res is 0
|
||||
select col_null and col_varchar from t1;
|
||||
col_null and col_varchar
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
// same as above
|
||||
select col_varchar and col_null from t1;
|
||||
col_varchar and col_null
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
// same as above
|
||||
select col_null and 0 from t1;
|
||||
col_null and 0
|
||||
0
|
||||
// Case1.2: 0 test
|
||||
// bool expr exists, no cast expr, res is 0
|
||||
select col_varchar_num and 0 from t1;
|
||||
col_varchar_num and 0
|
||||
0
|
||||
// same as above
|
||||
select col_varchar_num and 0 from t1;
|
||||
col_varchar_num and 0
|
||||
0
|
||||
// Case1.3: empty str test
|
||||
// bool expr and cast expr exists for empty str, res is 0
|
||||
select col_int and '' from t1;
|
||||
col_int and ''
|
||||
0
|
||||
// same as above
|
||||
select '' and col_int from t1;
|
||||
'' and col_int
|
||||
0
|
||||
// bool expr and cast expr exists for empty str and col_varchar, res is 0
|
||||
select col_varchar and '' from t1;
|
||||
col_varchar and ''
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
// same as above
|
||||
select '' and col_varchar from t1;
|
||||
'' and col_varchar
|
||||
0
|
||||
// bool expr and cast expr exists for empty str and col_varchar_num, res is 0
|
||||
select col_varchar_num and '' from t1;
|
||||
col_varchar_num and ''
|
||||
0
|
||||
// same as above
|
||||
select '' and col_varchar_num from t1;
|
||||
'' and col_varchar_num
|
||||
0
|
||||
// Case2: create table as test. 因为select/explain语句对应的cast mode
|
||||
// 有WARN_ON_FAIL。其他的没有,所以结果是有区别的
|
||||
// TODO: 目前没法测试,建表语句还不完善
|
||||
// Case3: or test
|
||||
// Case3.1 normal test
|
||||
// bool expr exists, res is 1
|
||||
select col_int or col_int from t1;
|
||||
col_int or col_int
|
||||
1
|
||||
// bool expr exists, res is 0
|
||||
select col_zero or col_zero from t1;
|
||||
col_zero or col_zero
|
||||
0
|
||||
// bool expr exists, cast expr exists res is 0
|
||||
select col_varchar_zero or col_varchar_zero from t1;
|
||||
col_varchar_zero or col_varchar_zero
|
||||
0
|
||||
// Case3.2 null test
|
||||
// bool expr exists, res is NULL
|
||||
select col_null or col_null from t1;
|
||||
col_null or col_null
|
||||
NULL
|
||||
// bool expr exists, res is 1
|
||||
select col_int or col_null from t1;
|
||||
col_int or col_null
|
||||
1
|
||||
// same as above
|
||||
select col_null or col_int from t1;
|
||||
col_null or col_int
|
||||
1
|
||||
// bool expr exists, res is NULL
|
||||
select col_zero or col_null from t1;
|
||||
col_zero or col_null
|
||||
NULL
|
||||
// same as above
|
||||
select col_null or col_zero from t1;
|
||||
col_null or col_zero
|
||||
NULL
|
||||
// bool expr exists, res is 1
|
||||
select col_varchar_num or col_null from t1;
|
||||
col_varchar_num or col_null
|
||||
1
|
||||
// same as above
|
||||
select col_null or col_varchar_num from t1;
|
||||
col_null or col_varchar_num
|
||||
1
|
||||
// bool expr exists, res is NULL
|
||||
select col_varchar_zero or col_null from t1;
|
||||
col_varchar_zero or col_null
|
||||
NULL
|
||||
// same as above
|
||||
select col_null or col_varchar_zero from t1;
|
||||
col_null or col_varchar_zero
|
||||
NULL
|
||||
// Case3.3 empty str test
|
||||
// bool expr exists, res is NULL
|
||||
select col_null or '' from t1;
|
||||
col_null or ''
|
||||
NULL
|
||||
// same as above
|
||||
select '' or col_null from t1;
|
||||
'' or col_null
|
||||
NULL
|
||||
// bool expr exists, res is 1
|
||||
select col_int or '' from t1;
|
||||
col_int or ''
|
||||
1
|
||||
// same as above
|
||||
select '' or col_int from t1;
|
||||
'' or col_int
|
||||
1
|
||||
// bool expr exists, res is 0
|
||||
select col_zero or '' from t1;
|
||||
col_zero or ''
|
||||
0
|
||||
// same as above
|
||||
select '' or col_zero from t1;
|
||||
'' or col_zero
|
||||
0
|
||||
// res is 0
|
||||
select col_empty_str or '' from t1;
|
||||
col_empty_str or ''
|
||||
0
|
||||
// Case4: multi and test
|
||||
// res is 1
|
||||
select 1 and 2 and 3 and col_int from t1;
|
||||
1 and 2 and 3 and col_int
|
||||
1
|
||||
// res is NULL
|
||||
select 1 and col_null and 3 and col_int from t1;
|
||||
1 and col_null and 3 and col_int
|
||||
NULL
|
||||
// res is 0
|
||||
select 1 and col_null and 3 and col_zero from t1;
|
||||
1 and col_null and 3 and col_zero
|
||||
0
|
||||
// res is 0
|
||||
select 1 and col_null and 3 and col_empty_str from t1;
|
||||
1 and col_null and 3 and col_empty_str
|
||||
0
|
||||
// Case5: multi or test
|
||||
// res is 1
|
||||
select 1 or 2 or col_int from t1;
|
||||
1 or 2 or col_int
|
||||
1
|
||||
// res is NULL
|
||||
select 1 or 2 or col_null from t1;
|
||||
1 or 2 or col_null
|
||||
1
|
||||
// res is 0
|
||||
select '' or 0 or col_null from t1;
|
||||
'' or 0 or col_null
|
||||
NULL
|
||||
// Case6: 0, 1, null三个值组合测试,结果跟不开新引擎的结果进行对比
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int, c3 int,
|
||||
c4 float, c5 float, c6 float,
|
||||
c7 double, c8 double, c9 double,
|
||||
c10 decimal, c11 decimal, c12 decimal,
|
||||
c13 datetime, c14 datetime, c15 datetime,
|
||||
c16 timestamp, c17 timestamp, c18 timestamp,
|
||||
c19 date, c20 date, c21 date,
|
||||
c22 varchar(10), c23 varchar(10), c24 varchar(10),
|
||||
c25 char(11), c26 char(11), c27 char(12),
|
||||
c28 char(10), c29 char(10), c30 char(10));
|
||||
insert into t1 values(0, 1, null,
|
||||
0.0, 1.0, null,
|
||||
0.0, 1.0, null,
|
||||
0.0, 1.0, null,
|
||||
0, '2019-01-01 00:00:00', null,
|
||||
0, '2019-01-01 00:00:00', null,
|
||||
0, '2019-01-01', null,
|
||||
'0', '123', null,
|
||||
'0', '123', null,
|
||||
'0', 'abc', null);
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select c1, c1, c1 and c1 from t1;
|
||||
c1 c1 c1 and c1
|
||||
0 0 0
|
||||
select c1, c1, c1 or c1 from t1;
|
||||
c1 c1 c1 or c1
|
||||
0 0 0
|
||||
select c1, c2, c1 and c2 from t1;
|
||||
c1 c2 c1 and c2
|
||||
0 1 0
|
||||
select c1, c2, c1 or c2 from t1;
|
||||
c1 c2 c1 or c2
|
||||
0 1 1
|
||||
select c1, c3, c1 and c3 from t1;
|
||||
c1 c3 c1 and c3
|
||||
0 NULL 0
|
||||
select c1, c3, c1 or c3 from t1;
|
||||
c1 c3 c1 or c3
|
||||
0 NULL NULL
|
||||
select c2, c1, c2 and c1 from t1;
|
||||
c2 c1 c2 and c1
|
||||
1 0 0
|
||||
select c2, c1, c2 or c1 from t1;
|
||||
c2 c1 c2 or c1
|
||||
1 0 1
|
||||
select c2, c2, c2 and c2 from t1;
|
||||
c2 c2 c2 and c2
|
||||
1 1 1
|
||||
select c2, c2, c2 or c2 from t1;
|
||||
c2 c2 c2 or c2
|
||||
1 1 1
|
||||
select c2, c3, c2 and c3 from t1;
|
||||
c2 c3 c2 and c3
|
||||
1 NULL NULL
|
||||
select c2, c3, c2 or c3 from t1;
|
||||
c2 c3 c2 or c3
|
||||
1 NULL 1
|
||||
select c3, c1, c3 and c1 from t1;
|
||||
c3 c1 c3 and c1
|
||||
NULL 0 0
|
||||
select c3, c1, c3 or c1 from t1;
|
||||
c3 c1 c3 or c1
|
||||
NULL 0 NULL
|
||||
select c3, c2, c3 and c2 from t1;
|
||||
c3 c2 c3 and c2
|
||||
NULL 1 NULL
|
||||
select c3, c2, c3 or c2 from t1;
|
||||
c3 c2 c3 or c2
|
||||
NULL 1 1
|
||||
select c3, c3, c3 and c3 from t1;
|
||||
c3 c3 c3 and c3
|
||||
NULL NULL NULL
|
||||
select c3, c3, c3 or c3 from t1;
|
||||
c3 c3 c3 or c3
|
||||
NULL NULL NULL
|
||||
drop table t1;
|
||||
CREATE TABLE t1(c0 VARCHAR(500), c1 DECIMAL);
|
||||
insert into t1 values('', 123);
|
||||
SELECT ALL t1.c0 AS ref0 FROM t1 WHERE (NULL AND ( CAST(COALESCE(t1.c0, EXISTS (SELECT 1)) AS SIGNED) IS NOT NULL)) IS NULL;
|
||||
ref0
|
||||
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: ''
|
||||
drop table t1;
|
||||
@ -0,0 +1,183 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int unsigned,
|
||||
c3 tinyint, c4 tinyint unsigned,
|
||||
c5 smallint, c6 smallint unsigned,
|
||||
c7 mediumint, c8 mediumint unsigned,
|
||||
c9 integer, c10 integer unsigned,
|
||||
c11 bigint, c12 bigint unsigned,
|
||||
c13 float, c14 float unsigned,
|
||||
c15 double, c16 double unsigned,
|
||||
c17 decimal, c18 decimal unsigned,
|
||||
c19 datetime, c20 timestamp,
|
||||
c21 varchar(30), c22 char(30));
|
||||
insert into t1 values(1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
3.5, 4.5,
|
||||
5.5, 6.5,
|
||||
7.5, 8.5,
|
||||
'2019-12-01 12:00:00', '2019-12-03 06:00:00',
|
||||
'9.5', '10.5');
|
||||
select @var1, @var2;
|
||||
@var1 @var2
|
||||
NULL NULL
|
||||
select @var2_1 := @var1_1 := c1 from t1;
|
||||
@var2_1 := @var1_1 := c1
|
||||
1
|
||||
select @var1_1, @var2_1;
|
||||
@var1_1 @var2_1
|
||||
1 1
|
||||
select @var2_2 := @var1_2 := c2 from t1;
|
||||
@var2_2 := @var1_2 := c2
|
||||
2
|
||||
select @var1_2, @var2_2;
|
||||
@var1_2 @var2_2
|
||||
2 2
|
||||
select @var2_3 := @var1_3 := c3 from t1;
|
||||
@var2_3 := @var1_3 := c3
|
||||
1
|
||||
select @var1_3, @var2_3;
|
||||
@var1_3 @var2_3
|
||||
1 1
|
||||
select @var2_4 := @var1_4 := c4 from t1;
|
||||
@var2_4 := @var1_4 := c4
|
||||
2
|
||||
select @var1_4, @var2_4;
|
||||
@var1_4 @var2_4
|
||||
2 2
|
||||
select @var2_5 := @var1_5 := c5 from t1;
|
||||
@var2_5 := @var1_5 := c5
|
||||
1
|
||||
select @var1_5, @var2_5;
|
||||
@var1_5 @var2_5
|
||||
1 1
|
||||
select @var2_6 := @var1_6 := c6 from t1;
|
||||
@var2_6 := @var1_6 := c6
|
||||
2
|
||||
select @var1_6, @var2_6;
|
||||
@var1_6 @var2_6
|
||||
2 2
|
||||
select @var2_7 := @var1_7 := c7 from t1;
|
||||
@var2_7 := @var1_7 := c7
|
||||
1
|
||||
select @var1_7, @var2_7;
|
||||
@var1_7 @var2_7
|
||||
1 1
|
||||
select @var2_8 := @var1_8 := c8 from t1;
|
||||
@var2_8 := @var1_8 := c8
|
||||
2
|
||||
select @var1_8, @var2_8;
|
||||
@var1_8 @var2_8
|
||||
2 2
|
||||
select @var2_9 := @var1_9 := c9 from t1;
|
||||
@var2_9 := @var1_9 := c9
|
||||
1
|
||||
select @var1_9, @var2_9;
|
||||
@var1_9 @var2_9
|
||||
1 1
|
||||
select @var2_10 := @var1_10 := c10 from t1;
|
||||
@var2_10 := @var1_10 := c10
|
||||
2
|
||||
select @var1_10, @var2_10;
|
||||
@var1_10 @var2_10
|
||||
2 2
|
||||
select @var2_11 := @var1_11 := c11 from t1;
|
||||
@var2_11 := @var1_11 := c11
|
||||
1
|
||||
select @var1_11, @var2_11;
|
||||
@var1_11 @var2_11
|
||||
1 1
|
||||
select @var2_12 := @var1_12 := c12 from t1;
|
||||
@var2_12 := @var1_12 := c12
|
||||
2
|
||||
select @var1_12, @var2_12;
|
||||
@var1_12 @var2_12
|
||||
2 2
|
||||
select @var2_13 := @var1_13 := c13 from t1;
|
||||
@var2_13 := @var1_13 := c13
|
||||
3.5
|
||||
select @var1_13, @var2_13;
|
||||
@var1_13 @var2_13
|
||||
3.5 3.5
|
||||
select @var2_14 := @var1_14 := c14 from t1;
|
||||
@var2_14 := @var1_14 := c14
|
||||
4.5
|
||||
select @var1_14, @var2_14;
|
||||
@var1_14 @var2_14
|
||||
4.5 4.5
|
||||
select @var2_15 := @var1_15 := c15 from t1;
|
||||
@var2_15 := @var1_15 := c15
|
||||
5.5
|
||||
select @var1_15, @var2_15;
|
||||
@var1_15 @var2_15
|
||||
5.5 5.5
|
||||
select @var2_16 := @var1_16 := c16 from t1;
|
||||
@var2_16 := @var1_16 := c16
|
||||
6.5
|
||||
select @var1_16, @var2_16;
|
||||
@var1_16 @var2_16
|
||||
6.5 6.5
|
||||
select @var2_17 := @var1_17 := c17 from t1;
|
||||
@var2_17 := @var1_17 := c17
|
||||
8
|
||||
select @var1_17, @var2_17;
|
||||
@var1_17 @var2_17
|
||||
8 8
|
||||
select @var2_18 := @var1_18 := c18 from t1;
|
||||
@var2_18 := @var1_18 := c18
|
||||
9
|
||||
select @var1_18, @var2_18;
|
||||
@var1_18 @var2_18
|
||||
9 9
|
||||
select @var2_19 := @var1_19 := c19 from t1;
|
||||
@var2_19 := @var1_19 := c19
|
||||
2019-12-01 12:00:00
|
||||
select @var1_19, @var2_19;
|
||||
@var1_19 @var2_19
|
||||
2019-12-01 12:00:00 2019-12-01 12:00:00
|
||||
select @var2_20 := @var1_20 := c20 from t1;
|
||||
@var2_20 := @var1_20 := c20
|
||||
2019-12-03 06:00:00
|
||||
select @var1_20, @var2_20;
|
||||
@var1_20 @var2_20
|
||||
2019-12-03 06:00:00 2019-12-03 06:00:00
|
||||
select @var2_21 := @var1_21 := c21 from t1;
|
||||
@var2_21 := @var1_21 := c21
|
||||
9.5
|
||||
select @var1_21, @var2_21;
|
||||
@var1_21 @var2_21
|
||||
9.5 9.5
|
||||
select @var2_22 := @var1_22 := c22 from t1;
|
||||
@var2_22 := @var1_22 := c22
|
||||
10.5
|
||||
select @var1_22, @var2_22;
|
||||
@var1_22 @var2_22
|
||||
10.5 10.5
|
||||
set @a = 1;
|
||||
select @a := @someval;
|
||||
@a := @someval
|
||||
NULL
|
||||
select @a;
|
||||
@a
|
||||
NULL
|
||||
drop view if exists vv;
|
||||
create view vv as select @a;
|
||||
desc vv;
|
||||
Field Type Null Key Default Extra
|
||||
@a varbinary(1048576) NO
|
||||
select @a := null;
|
||||
@a := null
|
||||
NULL
|
||||
select @a;
|
||||
@a
|
||||
NULL
|
||||
drop view if exists vv;
|
||||
create view vv as select @a;
|
||||
desc vv;
|
||||
Field Type Null Key Default Extra
|
||||
@a varbinary(1048576) NO
|
||||
3922
test/mysql_test/test_suite/static_engine/r/mysql/expr_bool.result
Normal file
3922
test/mysql_test/test_suite/static_engine/r/mysql/expr_bool.result
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,43 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
set ob_enable_plan_cache = 0;
|
||||
select char_length(1234);
|
||||
char_length(1234)
|
||||
4
|
||||
select char_length(1);
|
||||
char_length(1)
|
||||
1
|
||||
select char_length(null);
|
||||
char_length(null)
|
||||
NULL
|
||||
select char_length('');
|
||||
char_length('')
|
||||
0
|
||||
select char_length('a');
|
||||
char_length('a')
|
||||
1
|
||||
select char_length(' a ');
|
||||
char_length(' a ')
|
||||
3
|
||||
select char_length(' a b');
|
||||
char_length(' a b')
|
||||
4
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 char(10), c3 varchar(10), c4 timestamp, c5 decimal);
|
||||
insert into t1 values(1, 'a ', 'a ', '2010-01-01 11:11:11', 10.1);
|
||||
select char_length(c1) from t1;
|
||||
char_length(c1)
|
||||
1
|
||||
select char_length(c2) from t1;
|
||||
char_length(c2)
|
||||
1
|
||||
select char_length(c3) from t1;
|
||||
char_length(c3)
|
||||
2
|
||||
select char_length(c4) from t1;
|
||||
char_length(c4)
|
||||
19
|
||||
select char_length(c5) from t1;
|
||||
char_length(c5)
|
||||
2
|
||||
@ -0,0 +1,138 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int unsigned,
|
||||
c3 tinyint, c4 tinyint unsigned,
|
||||
c5 smallint, c6 smallint unsigned,
|
||||
c7 mediumint, c8 mediumint unsigned,
|
||||
c9 integer, c10 integer unsigned,
|
||||
c11 bigint, c12 bigint unsigned,
|
||||
c13 float, c14 float unsigned,
|
||||
c15 double, c16 double unsigned,
|
||||
c17 decimal, c18 decimal unsigned,
|
||||
c19 datetime, c20 timestamp,
|
||||
c21 varchar(30), c22 char(30),
|
||||
c23 varchar(30) charset utf8);
|
||||
insert into t1 values(1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
3.5, 4.5,
|
||||
5.5, 6.5,
|
||||
7.5, 8.5,
|
||||
'2019-12-01 12:00:00', '2019-12-03 06:00:00',
|
||||
'9.5', '10.5', 'utf8 col');
|
||||
insert into t1 values(-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-3.5, 4.5,
|
||||
-5.5, 6.5,
|
||||
-7.5, 8.5,
|
||||
'2019-12-01 12:00:00', '2019-12-03 06:00:00',
|
||||
'-9.5', '10.5', 'utf8 col');
|
||||
select c1, charset(c1), collation(c1), coercibility(c1) from t1;
|
||||
c1 charset(c1) collation(c1) coercibility(c1)
|
||||
1 binary binary 5
|
||||
-1 binary binary 5
|
||||
select c2, charset(c2), collation(c2), coercibility(c2) from t1;
|
||||
c2 charset(c2) collation(c2) coercibility(c2)
|
||||
2 binary binary 5
|
||||
2 binary binary 5
|
||||
select c3, charset(c3), collation(c3), coercibility(c3) from t1;
|
||||
c3 charset(c3) collation(c3) coercibility(c3)
|
||||
1 binary binary 5
|
||||
-1 binary binary 5
|
||||
select c4, charset(c4), collation(c4), coercibility(c4) from t1;
|
||||
c4 charset(c4) collation(c4) coercibility(c4)
|
||||
2 binary binary 5
|
||||
2 binary binary 5
|
||||
select c5, charset(c5), collation(c5), coercibility(c5) from t1;
|
||||
c5 charset(c5) collation(c5) coercibility(c5)
|
||||
1 binary binary 5
|
||||
-1 binary binary 5
|
||||
select c6, charset(c6), collation(c6), coercibility(c6) from t1;
|
||||
c6 charset(c6) collation(c6) coercibility(c6)
|
||||
2 binary binary 5
|
||||
2 binary binary 5
|
||||
select c7, charset(c7), collation(c7), coercibility(c7) from t1;
|
||||
c7 charset(c7) collation(c7) coercibility(c7)
|
||||
1 binary binary 5
|
||||
-1 binary binary 5
|
||||
select c8, charset(c8), collation(c8), coercibility(c8) from t1;
|
||||
c8 charset(c8) collation(c8) coercibility(c8)
|
||||
2 binary binary 5
|
||||
2 binary binary 5
|
||||
select c9, charset(c9), collation(c9), coercibility(c9) from t1;
|
||||
c9 charset(c9) collation(c9) coercibility(c9)
|
||||
1 binary binary 5
|
||||
-1 binary binary 5
|
||||
select c10, charset(c10), collation(c10), coercibility(c10) from t1;
|
||||
c10 charset(c10) collation(c10) coercibility(c10)
|
||||
2 binary binary 5
|
||||
2 binary binary 5
|
||||
select c11, charset(c11), collation(c11), coercibility(c11) from t1;
|
||||
c11 charset(c11) collation(c11) coercibility(c11)
|
||||
1 binary binary 5
|
||||
-1 binary binary 5
|
||||
select c12, charset(c12), collation(c12), coercibility(c12) from t1;
|
||||
c12 charset(c12) collation(c12) coercibility(c12)
|
||||
2 binary binary 5
|
||||
2 binary binary 5
|
||||
select c13, charset(c13), collation(c13), coercibility(c13) from t1;
|
||||
c13 charset(c13) collation(c13) coercibility(c13)
|
||||
3.5 binary binary 5
|
||||
-3.5 binary binary 5
|
||||
select c14, charset(c14), collation(c14), coercibility(c14) from t1;
|
||||
c14 charset(c14) collation(c14) coercibility(c14)
|
||||
4.5 binary binary 5
|
||||
4.5 binary binary 5
|
||||
select c15, charset(c15), collation(c15), coercibility(c15) from t1;
|
||||
c15 charset(c15) collation(c15) coercibility(c15)
|
||||
5.5 binary binary 5
|
||||
-5.5 binary binary 5
|
||||
select c16, charset(c16), collation(c16), coercibility(c16) from t1;
|
||||
c16 charset(c16) collation(c16) coercibility(c16)
|
||||
6.5 binary binary 5
|
||||
6.5 binary binary 5
|
||||
select c17, charset(c17), collation(c17), coercibility(c17) from t1;
|
||||
c17 charset(c17) collation(c17) coercibility(c17)
|
||||
8 binary binary 5
|
||||
-8 binary binary 5
|
||||
select c18, charset(c18), collation(c18), coercibility(c18) from t1;
|
||||
c18 charset(c18) collation(c18) coercibility(c18)
|
||||
9 binary binary 5
|
||||
9 binary binary 5
|
||||
select c19, charset(c19), collation(c19), coercibility(c19) from t1;
|
||||
c19 charset(c19) collation(c19) coercibility(c19)
|
||||
2019-12-01 12:00:00 binary binary 5
|
||||
2019-12-01 12:00:00 binary binary 5
|
||||
select c20, charset(c20), collation(c20), coercibility(c20) from t1;
|
||||
c20 charset(c20) collation(c20) coercibility(c20)
|
||||
2019-12-03 06:00:00 binary binary 5
|
||||
2019-12-03 06:00:00 binary binary 5
|
||||
select c21, charset(c21), collation(c21), coercibility(c21) from t1;
|
||||
c21 charset(c21) collation(c21) coercibility(c21)
|
||||
9.5 utf8mb4 utf8mb4_general_ci 2
|
||||
-9.5 utf8mb4 utf8mb4_general_ci 2
|
||||
select c22, charset(c22), collation(c22), coercibility(c22) from t1;
|
||||
c22 charset(c22) collation(c22) coercibility(c22)
|
||||
10.5 utf8mb4 utf8mb4_general_ci 2
|
||||
10.5 utf8mb4 utf8mb4_general_ci 2
|
||||
// test set_collation expr
|
||||
// set_collation表达式检查charset与collate不匹配,报错
|
||||
// 下面的是等号表达式在类型推导时,进行aggregate collation发现collation不一致报错
|
||||
select _utf8mb4'a' collate utf8mb4_general_ci = _utf8mb4'A' collate utf8mb4_bin;
|
||||
ERROR HY000: Illegal mix of collations
|
||||
select _utf8mb4'a' collate utf8mb4_general_ci = _utf8mb4'A' collate utf8mb4_general_ci;
|
||||
_utf8mb4'a' collate utf8mb4_general_ci = _utf8mb4'A' collate utf8mb4_general_ci
|
||||
1
|
||||
select _utf8mb4'a' collate utf8mb4_bin = _utf8mb4'A' collate utf8mb4_bin;
|
||||
_utf8mb4'a' collate utf8mb4_bin = _utf8mb4'A' collate utf8mb4_bin
|
||||
0
|
||||
drop table t1;
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,25 @@
|
||||
connect sys, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select conv('a',16,2) from dual;
|
||||
conv('a',16,2)
|
||||
1010
|
||||
select conv('6E',18,8) from dual;
|
||||
conv('6E',18,8)
|
||||
172
|
||||
select conv(-17,10,-18) from dual;
|
||||
conv(-17,10,-18)
|
||||
-H
|
||||
select conv(10+'10'+'10'+X'0a',10,10) from dual;
|
||||
conv(10+'10'+'10'+X'0a',10,10)
|
||||
40
|
||||
select conv(null, 16, 2) from dual;
|
||||
conv(null, 16, 2)
|
||||
NULL
|
||||
select conv('6E',null,8) from dual;
|
||||
conv('6E',null,8)
|
||||
NULL
|
||||
select conv('6E',18, null) from dual;
|
||||
conv('6E',18, null)
|
||||
NULL
|
||||
connection sys;
|
||||
@ -0,0 +1,18 @@
|
||||
connect sys, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 varchar(2000));
|
||||
insert into t1 values("2019-10-11");
|
||||
connection sys;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select date(c1) from t1;
|
||||
date(c1)
|
||||
2019-10-11
|
||||
select date("2019-10-10") from dual;
|
||||
date("2019-10-10")
|
||||
2019-10-10
|
||||
select date(null) from dual;
|
||||
date(null)
|
||||
NULL
|
||||
connection sys;
|
||||
@ -0,0 +1,34 @@
|
||||
connect sys, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 varchar(30), c2 date, c3 date);
|
||||
insert into t1 values("2019-10-11", "2019-01-10", "2018-01-01");
|
||||
insert into t1 values(null, "2019-01-10", null);
|
||||
insert into t1 values("2019-10-11", "0000-00-00", "2019-10-19");
|
||||
connection sys;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select datediff(c1, c2), datediff(c2, c3) from t1;
|
||||
datediff(c1, c2) datediff(c2, c3)
|
||||
274 374
|
||||
NULL NULL
|
||||
NULL NULL
|
||||
select datediff(20080701, "2008-08-01");
|
||||
datediff(20080701, "2008-08-01")
|
||||
-31
|
||||
select datediff("20080701", "2012-05-25");
|
||||
datediff("20080701", "2012-05-25")
|
||||
-1424
|
||||
select datediff("2012-05-25","20080701");
|
||||
datediff("2012-05-25","20080701")
|
||||
1424
|
||||
select datediff(null,null);
|
||||
datediff(null,null)
|
||||
NULL
|
||||
select datediff(null,"2012-05-25");
|
||||
datediff(null,"2012-05-25")
|
||||
NULL
|
||||
select datediff("2012-05-25","0000-00-00");
|
||||
datediff("2012-05-25","0000-00-00")
|
||||
NULL
|
||||
connection sys;
|
||||
@ -0,0 +1,25 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select des_hex_str("11053FFF80EAB6BADEE6F501");
|
||||
des_hex_str("11053FFF80EAB6BADEE6F501")
|
||||
2004-04-04 04:04:04.000000
|
||||
select des_hex_str("0C053FFFB8BD94DC9E8A8E8B40");
|
||||
des_hex_str("0C053FFFB8BD94DC9E8A8E8B40")
|
||||
5.555
|
||||
select des_hex_str("0C053FFFB8BD94DC9E8A8E8B40");
|
||||
des_hex_str("0C053FFFB8BD94DC9E8A8E8B40")
|
||||
5.555
|
||||
select des_hex_str("04053FFF05");
|
||||
des_hex_str("04053FFF05")
|
||||
5
|
||||
select des_hex_str("0C053FFFADE4F6FCFED4F1F83F");
|
||||
des_hex_str("0C053FFFADE4F6FCFED4F1F83F")
|
||||
1.111
|
||||
select des_hex_str("0B053FFF8080C08504");
|
||||
des_hex_str("0B053FFF8080C08504")
|
||||
5.5
|
||||
select des_hex_str(NULL);
|
||||
ERROR HY000: Invalid argument
|
||||
connection syscon;
|
||||
@ -0,0 +1,21 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select dump(NULL);
|
||||
dump(NULL)
|
||||
NULL
|
||||
select dump(0.2);
|
||||
dump(0.2)
|
||||
"sign=1 exp=63 se=0xbf len=1 digits=[200000000,]"
|
||||
select dump(2);
|
||||
ERROR 0A000: Not supported feature or function
|
||||
select dump('abcdef');
|
||||
ERROR 0A000: Not supported feature or function
|
||||
select dump('abcdef');
|
||||
ERROR 0A000: Not supported feature or function
|
||||
select dump(date'2020-01-01');
|
||||
ERROR 0A000: Not supported feature or function
|
||||
select dump(timestamp'2020-01-01');
|
||||
ERROR 0A000: Not supported feature or function
|
||||
connection syscon;
|
||||
@ -0,0 +1,123 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system set enable_async_syslog = false;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
set @@ob_log_level='debug';
|
||||
drop view if exists v1;
|
||||
create view v1 as select connection_id() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
connection_id() int(10) unsigned NO
|
||||
drop view v1;
|
||||
create view v1 as select utc_timestamp() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
utc_timestamp() datetime NO
|
||||
drop view v1;
|
||||
create view v1 as select utc_timestamp(3) from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
utc_timestamp(3) datetime(3) NO
|
||||
drop view v1;
|
||||
create view v1 as select current_timestamp() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
current_timestamp() datetime NO
|
||||
drop view v1;
|
||||
create view v1 as select current_timestamp(3) from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
current_timestamp(3) datetime NO
|
||||
drop view v1;
|
||||
create view v1 as select sysdate() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
sysdate() datetime NO
|
||||
drop view v1;
|
||||
create view v1 as select sysdate(3) from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
sysdate(3) datetime NO
|
||||
drop view v1;
|
||||
create view v1 as select cur_date() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
cur_date() date NO
|
||||
drop view v1;
|
||||
create view v1 as select curtime() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
curtime() time NO
|
||||
drop view v1;
|
||||
create view v1 as select current_user() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
current_user() varchar(193) NO
|
||||
drop view v1;
|
||||
create view v1 as select database() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
database() varchar(128) NO
|
||||
drop view v1;
|
||||
create view v1 as select effective_tenant_id() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
effective_tenant_id() bigint(20) unsigned NO
|
||||
drop view v1;
|
||||
create view v1 as select effective_tenant() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
effective_tenant() varchar(64) NO
|
||||
drop view v1;
|
||||
create view v1 as select found_rows() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
found_rows() bigint(20) NO
|
||||
drop view v1;
|
||||
create view v1 as select host_ip() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
host_ip() varchar(46) NO
|
||||
drop view v1;
|
||||
create view v1 as select last_execution_id() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
last_execution_id() bigint NO
|
||||
drop view v1;
|
||||
create view v1 as select last_trace_id() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
last_trace_id() varchar(128) NO
|
||||
drop view v1;
|
||||
create view v1 as select mysql_port() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
mysql_port() bigint(20) NO
|
||||
drop view v1;
|
||||
create view v1 as select rpc_port() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
rpc_port() int(11) NO
|
||||
drop view v1;
|
||||
create view v1 as select row_count() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
row_count() bigint(20) NO
|
||||
drop view v1;
|
||||
create view v1 as select uuid() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
uuid() varchar(36) NO
|
||||
drop view v1;
|
||||
create view v1 as select user() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
user() varchar(193) NO
|
||||
drop view v1;
|
||||
create view v1 as select version() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
version() varchar(5) NO
|
||||
drop view v1;
|
||||
connection conn_admin;
|
||||
@ -0,0 +1,29 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select field(1, 3, 2, 1, NULL);
|
||||
field(1, 3, 2, 1, NULL)
|
||||
3
|
||||
select field(1, 3, 2, 1, NULL, 1);
|
||||
field(1, 3, 2, 1, NULL, 1)
|
||||
3
|
||||
select field(NULL, 3, 2, 1, NULL);
|
||||
field(NULL, 3, 2, 1, NULL)
|
||||
0
|
||||
select field(2, 3, NULL, 2, 1, NULL);
|
||||
field(2, 3, NULL, 2, 1, NULL)
|
||||
3
|
||||
select field(1, 3, 2, "1", NULL);
|
||||
field(1, 3, 2, "1", NULL)
|
||||
3
|
||||
select field(1, 3, 2.2, "1", NULL);
|
||||
field(1, 3, 2.2, "1", NULL)
|
||||
3
|
||||
select field("abc", 3.2, "def", 'abc');
|
||||
field("abc", 3.2, "def", 'abc')
|
||||
2
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'def'
|
||||
connection syscon;
|
||||
@ -0,0 +1,30 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
// res type is string
|
||||
select @@ob_log_level;
|
||||
@@ob_log_level
|
||||
disabled
|
||||
set @@ob_log_level='debug';
|
||||
select @@ob_log_level;
|
||||
@@ob_log_level
|
||||
debug
|
||||
set @@ob_log_level='info';
|
||||
// res type is bool
|
||||
set @@ob_enable_plan_cache = 1;
|
||||
select @@ob_enable_plan_cache = 0;
|
||||
@@ob_enable_plan_cache = 0
|
||||
0
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select @@ob_enable_plan_cache = 0;
|
||||
@@ob_enable_plan_cache = 0
|
||||
1
|
||||
// res type is int
|
||||
select @@ob_plan_cache_percentage;
|
||||
@@ob_plan_cache_percentage
|
||||
5
|
||||
// test null
|
||||
set character_set_results=NULL;
|
||||
select @@character_set_results;
|
||||
@@character_set_results
|
||||
NULL
|
||||
@ -0,0 +1,31 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
set ob_enable_plan_cache = 0;
|
||||
set @var1 = NULL;
|
||||
select @var1 from dual;
|
||||
@var1
|
||||
NULL
|
||||
set @var1 = 1;
|
||||
select @var1 from dual;
|
||||
@var1
|
||||
1
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values(@var1);
|
||||
select * from t1;
|
||||
c1
|
||||
1
|
||||
set @a=0,@b=0;
|
||||
select @a:=10, @b:=1, @a > @b, @a < @b;
|
||||
@a:=10 @b:=1 @a > @b @a < @b
|
||||
10 1 1 0
|
||||
select @a:="10", @b:="1", @a > @b, @a < @b;
|
||||
@a:="10" @b:="1" @a > @b @a < @b
|
||||
10 1 1 0
|
||||
select @a:=10, @b:=2, @a > @b, @a < @b;
|
||||
@a:=10 @b:=2 @a > @b @a < @b
|
||||
10 2 0 1
|
||||
select @a:="10", @b:="2", @a > @b, @a < @b;
|
||||
@a:="10" @b:="2" @a > @b @a < @b
|
||||
10 2 1 0
|
||||
388
test/mysql_test/test_suite/static_engine/r/mysql/expr_is.result
Normal file
388
test/mysql_test/test_suite/static_engine/r/mysql/expr_is.result
Normal file
@ -0,0 +1,388 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int unsigned,
|
||||
c3 tinyint, c4 tinyint unsigned,
|
||||
c5 smallint, c6 smallint unsigned,
|
||||
c7 mediumint, c8 mediumint unsigned,
|
||||
c9 integer, c10 integer unsigned,
|
||||
c11 bigint, c12 bigint unsigned,
|
||||
c13 float, c14 float unsigned,
|
||||
c15 double, c16 double unsigned,
|
||||
c17 decimal, c18 decimal unsigned,
|
||||
c19 date, c20 date not null,
|
||||
c21 datetime, c22 datetime not null,
|
||||
c23 timestamp, c24 timestamp not null,
|
||||
c25 varchar(30), c26 char(30));
|
||||
select * from t1;
|
||||
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26
|
||||
insert into t1 values(NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, '0000-00-00',
|
||||
NULL, '0000-00-00 00:00:00',
|
||||
NULL, '0000-00-00 00:00:00',
|
||||
NULL, NULL);
|
||||
insert into t1 values(0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0.0, 0.0,
|
||||
0.0, 0.0,
|
||||
0.0, 0.0,
|
||||
'0000-00-00', '0000-00-00',
|
||||
'0000-00-00 00:00:00', '0000-00-00 00:00:00',
|
||||
'0000-00-00 00:00:00', '0000-00-00 00:00:00',
|
||||
'0', '0.0');
|
||||
insert into t1 values(1, 1,
|
||||
1, 1,
|
||||
1, 1,
|
||||
1, 1,
|
||||
1, 1,
|
||||
1, 1,
|
||||
-0.1, 0.1,
|
||||
-0.1, 0.1,
|
||||
-0.1, 0.1,
|
||||
'0001-01-01', '0001-01-01',
|
||||
'0001-01-01 00:00:00', '0001-01-01 00:00:00',
|
||||
'0001-01-01 00:00:00', '0001-01-01 00:00:00',
|
||||
'1', '1.0');
|
||||
insert into t1 values(11, 11,
|
||||
11, 11,
|
||||
11, 11,
|
||||
11, 11,
|
||||
11, 11,
|
||||
11, 11,
|
||||
11.0, 11.0,
|
||||
11.0, 11.0,
|
||||
11.0, 11.0,
|
||||
'2019-12-01 12:00:00', '2019-12-01 12:00:00',
|
||||
'2019-12-01 12:00:00', '2019-12-01 12:00:00',
|
||||
'2019-12-01 12:00:00', '2019-12-01 12:00:00',
|
||||
'11', '11.0');
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select c1, c1 is true, c1 is false, c1 is null, c1 is unknown from t1;
|
||||
c1 c1 is true c1 is false c1 is null c1 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c1, c1 is not true, c1 is not false, c1 is not null, c1 is not unknown from t1;
|
||||
c1 c1 is not true c1 is not false c1 is not null c1 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c2, c2 is true, c2 is false, c2 is null, c2 is unknown from t1;
|
||||
c2 c2 is true c2 is false c2 is null c2 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c2, c2 is not true, c2 is not false, c2 is not null, c2 is not unknown from t1;
|
||||
c2 c2 is not true c2 is not false c2 is not null c2 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c3, c3 is true, c3 is false, c3 is null, c3 is unknown from t1;
|
||||
c3 c3 is true c3 is false c3 is null c3 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c3, c3 is not true, c3 is not false, c3 is not null, c3 is not unknown from t1;
|
||||
c3 c3 is not true c3 is not false c3 is not null c3 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c4, c4 is true, c4 is false, c4 is null, c4 is unknown from t1;
|
||||
c4 c4 is true c4 is false c4 is null c4 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c4, c4 is not true, c4 is not false, c4 is not null, c4 is not unknown from t1;
|
||||
c4 c4 is not true c4 is not false c4 is not null c4 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c5, c5 is true, c5 is false, c5 is null, c5 is unknown from t1;
|
||||
c5 c5 is true c5 is false c5 is null c5 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c5, c5 is not true, c5 is not false, c5 is not null, c5 is not unknown from t1;
|
||||
c5 c5 is not true c5 is not false c5 is not null c5 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c6, c6 is true, c6 is false, c6 is null, c6 is unknown from t1;
|
||||
c6 c6 is true c6 is false c6 is null c6 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c6, c6 is not true, c6 is not false, c6 is not null, c6 is not unknown from t1;
|
||||
c6 c6 is not true c6 is not false c6 is not null c6 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c7, c7 is true, c7 is false, c7 is null, c7 is unknown from t1;
|
||||
c7 c7 is true c7 is false c7 is null c7 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c7, c7 is not true, c7 is not false, c7 is not null, c7 is not unknown from t1;
|
||||
c7 c7 is not true c7 is not false c7 is not null c7 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c8, c8 is true, c8 is false, c8 is null, c8 is unknown from t1;
|
||||
c8 c8 is true c8 is false c8 is null c8 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c8, c8 is not true, c8 is not false, c8 is not null, c8 is not unknown from t1;
|
||||
c8 c8 is not true c8 is not false c8 is not null c8 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c9, c9 is true, c9 is false, c9 is null, c9 is unknown from t1;
|
||||
c9 c9 is true c9 is false c9 is null c9 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c9, c9 is not true, c9 is not false, c9 is not null, c9 is not unknown from t1;
|
||||
c9 c9 is not true c9 is not false c9 is not null c9 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c10, c10 is true, c10 is false, c10 is null, c10 is unknown from t1;
|
||||
c10 c10 is true c10 is false c10 is null c10 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c10, c10 is not true, c10 is not false, c10 is not null, c10 is not unknown from t1;
|
||||
c10 c10 is not true c10 is not false c10 is not null c10 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c11, c11 is true, c11 is false, c11 is null, c11 is unknown from t1;
|
||||
c11 c11 is true c11 is false c11 is null c11 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c11, c11 is not true, c11 is not false, c11 is not null, c11 is not unknown from t1;
|
||||
c11 c11 is not true c11 is not false c11 is not null c11 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c12, c12 is true, c12 is false, c12 is null, c12 is unknown from t1;
|
||||
c12 c12 is true c12 is false c12 is null c12 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c12, c12 is not true, c12 is not false, c12 is not null, c12 is not unknown from t1;
|
||||
c12 c12 is not true c12 is not false c12 is not null c12 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c13, c13 is true, c13 is false, c13 is null, c13 is unknown from t1;
|
||||
c13 c13 is true c13 is false c13 is null c13 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
-0.1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c13, c13 is not true, c13 is not false, c13 is not null, c13 is not unknown from t1;
|
||||
c13 c13 is not true c13 is not false c13 is not null c13 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
-0.1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c14, c14 is true, c14 is false, c14 is null, c14 is unknown from t1;
|
||||
c14 c14 is true c14 is false c14 is null c14 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
0.1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c14, c14 is not true, c14 is not false, c14 is not null, c14 is not unknown from t1;
|
||||
c14 c14 is not true c14 is not false c14 is not null c14 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
0.1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c15, c15 is true, c15 is false, c15 is null, c15 is unknown from t1;
|
||||
c15 c15 is true c15 is false c15 is null c15 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
-0.1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c15, c15 is not true, c15 is not false, c15 is not null, c15 is not unknown from t1;
|
||||
c15 c15 is not true c15 is not false c15 is not null c15 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
-0.1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c16, c16 is true, c16 is false, c16 is null, c16 is unknown from t1;
|
||||
c16 c16 is true c16 is false c16 is null c16 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
0.1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c16, c16 is not true, c16 is not false, c16 is not null, c16 is not unknown from t1;
|
||||
c16 c16 is not true c16 is not false c16 is not null c16 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
0.1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c17, c17 is true, c17 is false, c17 is null, c17 is unknown from t1;
|
||||
c17 c17 is true c17 is false c17 is null c17 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
0 0 1 0 0
|
||||
11 1 0 0 0
|
||||
select c17, c17 is not true, c17 is not false, c17 is not null, c17 is not unknown from t1;
|
||||
c17 c17 is not true c17 is not false c17 is not null c17 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
0 1 0 1 1
|
||||
11 0 1 1 1
|
||||
select c18, c18 is true, c18 is false, c18 is null, c18 is unknown from t1;
|
||||
c18 c18 is true c18 is false c18 is null c18 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
0 0 1 0 0
|
||||
11 1 0 0 0
|
||||
select c18, c18 is not true, c18 is not false, c18 is not null, c18 is not unknown from t1;
|
||||
c18 c18 is not true c18 is not false c18 is not null c18 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
0 1 0 1 1
|
||||
11 0 1 1 1
|
||||
select c19, c19 is true, c19 is false, c19 is null, c19 is unknown from t1;
|
||||
c19 c19 is true c19 is false c19 is null c19 is unknown
|
||||
NULL 0 0 1 1
|
||||
0000-00-00 0 1 0 0
|
||||
0001-01-01 1 0 0 0
|
||||
2019-12-01 1 0 0 0
|
||||
select c19, c19 is not true, c19 is not false, c19 is not null, c19 is not unknown from t1;
|
||||
c19 c19 is not true c19 is not false c19 is not null c19 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0000-00-00 1 0 1 1
|
||||
0001-01-01 0 1 1 1
|
||||
2019-12-01 0 1 1 1
|
||||
select c20, c20 is true, c20 is false, c20 is null, c20 is unknown from t1;
|
||||
c20 c20 is true c20 is false c20 is null c20 is unknown
|
||||
0000-00-00 0 1 0 0
|
||||
0000-00-00 0 1 0 0
|
||||
0001-01-01 1 0 0 0
|
||||
2019-12-01 1 0 0 0
|
||||
select c20, c20 is not true, c20 is not false, c20 is not null, c20 is not unknown from t1;
|
||||
c20 c20 is not true c20 is not false c20 is not null c20 is not unknown
|
||||
0000-00-00 1 0 1 1
|
||||
0000-00-00 1 0 1 1
|
||||
0001-01-01 0 1 1 1
|
||||
2019-12-01 0 1 1 1
|
||||
select c21, c21 is true, c21 is false, c21 is null, c21 is unknown from t1;
|
||||
c21 c21 is true c21 is false c21 is null c21 is unknown
|
||||
NULL 0 0 1 1
|
||||
0000-00-00 00:00:00 0 1 0 0
|
||||
0001-01-01 00:00:00 1 0 0 0
|
||||
2019-12-01 12:00:00 1 0 0 0
|
||||
select c21, c21 is not true, c21 is not false, c21 is not null, c21 is not unknown from t1;
|
||||
c21 c21 is not true c21 is not false c21 is not null c21 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0000-00-00 00:00:00 1 0 1 1
|
||||
0001-01-01 00:00:00 0 1 1 1
|
||||
2019-12-01 12:00:00 0 1 1 1
|
||||
select c22, c22 is true, c22 is false, c22 is null, c22 is unknown from t1;
|
||||
c22 c22 is true c22 is false c22 is null c22 is unknown
|
||||
0000-00-00 00:00:00 0 1 0 0
|
||||
0000-00-00 00:00:00 0 1 0 0
|
||||
0001-01-01 00:00:00 1 0 0 0
|
||||
2019-12-01 12:00:00 1 0 0 0
|
||||
select c22, c22 is not true, c22 is not false, c22 is not null, c22 is not unknown from t1;
|
||||
c22 c22 is not true c22 is not false c22 is not null c22 is not unknown
|
||||
0000-00-00 00:00:00 1 0 1 1
|
||||
0000-00-00 00:00:00 1 0 1 1
|
||||
0001-01-01 00:00:00 0 1 1 1
|
||||
2019-12-01 12:00:00 0 1 1 1
|
||||
select c23, c23 is true, c23 is false, c23 is null, c23 is unknown from t1;
|
||||
c23 c23 is true c23 is false c23 is null c23 is unknown
|
||||
NULL 0 0 1 1
|
||||
0000-00-00 00:00:00 0 1 0 0
|
||||
0001-01-01 00:00:00 1 0 0 0
|
||||
2019-12-01 12:00:00 1 0 0 0
|
||||
select c23, c23 is not true, c23 is not false, c23 is not null, c23 is not unknown from t1;
|
||||
c23 c23 is not true c23 is not false c23 is not null c23 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0000-00-00 00:00:00 1 0 1 1
|
||||
0001-01-01 00:00:00 0 1 1 1
|
||||
2019-12-01 12:00:00 0 1 1 1
|
||||
select c24, c24 is true, c24 is false, c24 is null, c24 is unknown from t1;
|
||||
c24 c24 is true c24 is false c24 is null c24 is unknown
|
||||
0000-00-00 00:00:00 0 1 0 0
|
||||
0000-00-00 00:00:00 0 1 0 0
|
||||
0001-01-01 00:00:00 1 0 0 0
|
||||
2019-12-01 12:00:00 1 0 0 0
|
||||
select c24, c24 is not true, c24 is not false, c24 is not null, c24 is not unknown from t1;
|
||||
c24 c24 is not true c24 is not false c24 is not null c24 is not unknown
|
||||
0000-00-00 00:00:00 1 0 1 1
|
||||
0000-00-00 00:00:00 1 0 1 1
|
||||
0001-01-01 00:00:00 0 1 1 1
|
||||
2019-12-01 12:00:00 0 1 1 1
|
||||
select c25, c25 is true, c25 is false, c25 is null, c25 is unknown from t1;
|
||||
c25 c25 is true c25 is false c25 is null c25 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c25, c25 is not true, c25 is not false, c25 is not null, c25 is not unknown from t1;
|
||||
c25 c25 is not true c25 is not false c25 is not null c25 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c26, c26 is true, c26 is false, c26 is null, c26 is unknown from t1;
|
||||
c26 c26 is true c26 is false c26 is null c26 is unknown
|
||||
NULL 0 0 1 1
|
||||
0.0 0 1 0 0
|
||||
1.0 1 0 0 0
|
||||
11.0 1 0 0 0
|
||||
select c26, c26 is not true, c26 is not false, c26 is not null, c26 is not unknown from t1;
|
||||
c26 c26 is not true c26 is not false c26 is not null c26 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0.0 1 0 1 1
|
||||
1.0 0 1 1 1
|
||||
11.0 0 1 1 1
|
||||
drop table t1;
|
||||
connection conn_admin;
|
||||
@ -0,0 +1,23 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select is_serving_tenant(host_ip(), rpc_port(), effective_tenant_id());
|
||||
is_serving_tenant(host_ip(), rpc_port(), effective_tenant_id())
|
||||
1
|
||||
select is_serving_tenant(host_ip(), rpc_port(), 1);
|
||||
is_serving_tenant(host_ip(), rpc_port(), 1)
|
||||
1
|
||||
select is_serving_tenant(host_ip(), rpc_port(), 888);
|
||||
is_serving_tenant(host_ip(), rpc_port(), 888)
|
||||
0
|
||||
select is_serving_tenant('abc', rpc_port(), effective_tenant_id());
|
||||
is_serving_tenant('abc', rpc_port(), effective_tenant_id())
|
||||
0
|
||||
select is_serving_tenant('abc', rpc_port(), 1);
|
||||
is_serving_tenant('abc', rpc_port(), 1)
|
||||
1
|
||||
select is_serving_tenant('abc', rpc_port(), 888);
|
||||
is_serving_tenant('abc', rpc_port(), 888)
|
||||
0
|
||||
connection syscon;
|
||||
@ -0,0 +1,143 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int unsigned,
|
||||
c3 tinyint, c4 tinyint unsigned,
|
||||
c5 bigint, c6 bigint unsigned,
|
||||
c7 float, c8 float unsigned,
|
||||
c9 double, c10 double unsigned,
|
||||
c11 decimal, c12 decimal unsigned,
|
||||
c13 date, c14 datetime, c15 timestamp,
|
||||
c16 varchar(30), c17 char(30));
|
||||
select * from t1;
|
||||
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17
|
||||
insert into t1 values(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
|
||||
insert into t1 values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '');
|
||||
insert into t1 values(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, '0013-01-01', '0014-01-01', '0015-01-01', '16', '17');
|
||||
insert into t1 values(-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, '0013-01-01', '0014-01-01 00:00:00', '0015-01-01 00:00:00', '-16', '-17');
|
||||
insert into t1 values(1234567, 7654321, -33, 44, 555555555, 666666666, 777.777, 8888.888, 99999.999999, 10000.00000, 1111, 121212121, '0013-01-01', '0014-01-01 00:00:11', '0015-01-01 00:00:11', 'sadfsadfdsafasasdf', 'asdffdsafadsfdsafsad');
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select c1, length(c1) from t1;
|
||||
c1 length(c1)
|
||||
NULL NULL
|
||||
0 1
|
||||
1 1
|
||||
-1 2
|
||||
1234567 7
|
||||
select c2, length(c2) from t1;
|
||||
c2 length(c2)
|
||||
NULL NULL
|
||||
0 1
|
||||
2 1
|
||||
2 1
|
||||
7654321 7
|
||||
select c3, length(c3) from t1;
|
||||
c3 length(c3)
|
||||
NULL NULL
|
||||
0 1
|
||||
3 1
|
||||
-3 2
|
||||
-33 3
|
||||
select c4, length(c4) from t1;
|
||||
c4 length(c4)
|
||||
NULL NULL
|
||||
0 1
|
||||
4 1
|
||||
4 1
|
||||
44 2
|
||||
select c5, length(c5) from t1;
|
||||
c5 length(c5)
|
||||
NULL NULL
|
||||
0 1
|
||||
5 1
|
||||
-5 2
|
||||
555555555 9
|
||||
select c6, length(c6) from t1;
|
||||
c6 length(c6)
|
||||
NULL NULL
|
||||
0 1
|
||||
6 1
|
||||
6 1
|
||||
666666666 9
|
||||
select c7, length(c7) from t1;
|
||||
c7 length(c7)
|
||||
NULL NULL
|
||||
0 1
|
||||
7 1
|
||||
-7 2
|
||||
777.777 7
|
||||
select c8, length(c8) from t1;
|
||||
c8 length(c8)
|
||||
NULL NULL
|
||||
0 1
|
||||
8 1
|
||||
8 1
|
||||
8888.89 7
|
||||
select c9, length(c9) from t1;
|
||||
c9 length(c9)
|
||||
NULL NULL
|
||||
0 1
|
||||
9 1
|
||||
-9 2
|
||||
99999.999999 12
|
||||
select c10, length(c10) from t1;
|
||||
c10 length(c10)
|
||||
NULL NULL
|
||||
0 1
|
||||
10 2
|
||||
10 2
|
||||
10000 5
|
||||
select c11, length(c11) from t1;
|
||||
c11 length(c11)
|
||||
NULL NULL
|
||||
0 1
|
||||
11 2
|
||||
-11 3
|
||||
1111 4
|
||||
select c12, length(c12) from t1;
|
||||
c12 length(c12)
|
||||
NULL NULL
|
||||
0 1
|
||||
12 2
|
||||
12 2
|
||||
121212121 9
|
||||
select c13, length(c13) from t1;
|
||||
c13 length(c13)
|
||||
NULL NULL
|
||||
0000-00-00 10
|
||||
0013-01-01 10
|
||||
0013-01-01 10
|
||||
0013-01-01 10
|
||||
select c14, length(c14) from t1;
|
||||
c14 length(c14)
|
||||
NULL NULL
|
||||
0000-00-00 00:00:00 19
|
||||
0014-01-01 00:00:00 19
|
||||
0014-01-01 00:00:00 19
|
||||
0014-01-01 00:00:11 19
|
||||
select c15, length(c15) from t1;
|
||||
c15 length(c15)
|
||||
NULL NULL
|
||||
0000-00-00 00:00:00 19
|
||||
0015-01-01 00:00:00 19
|
||||
0015-01-01 00:00:00 19
|
||||
0015-01-01 00:00:11 19
|
||||
select c16, length(c16) from t1;
|
||||
c16 length(c16)
|
||||
NULL NULL
|
||||
0
|
||||
16 2
|
||||
-16 3
|
||||
sadfsadfdsafasasdf 18
|
||||
select c17, length(c17) from t1;
|
||||
c17 length(c17)
|
||||
NULL NULL
|
||||
0
|
||||
17 2
|
||||
-17 3
|
||||
asdffdsafadsfdsafsad 20
|
||||
drop table t1;
|
||||
connection conn_admin;
|
||||
@ -0,0 +1,20 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select lnnvl(1) from dual;
|
||||
lnnvl(1)
|
||||
0
|
||||
select lnnvl(-1) from dual;
|
||||
lnnvl(-1)
|
||||
0
|
||||
select lnnvl(0) from dual;
|
||||
lnnvl(0)
|
||||
1
|
||||
select lnnvl(NULL) from dual;
|
||||
lnnvl(NULL)
|
||||
1
|
||||
select lnnvl('abc') from dual;
|
||||
lnnvl('abc')
|
||||
1
|
||||
connection syscon;
|
||||
@ -0,0 +1,64 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
// locate(substr, oristr), instr(oristr, substr)
|
||||
select locate(null, 'a'), locate('a', null), locate('a', 'a', null);
|
||||
locate(null, 'a') locate('a', null) locate('a', 'a', null)
|
||||
NULL NULL 0
|
||||
select locate('abc', 'a'), instr('abc', 'a');
|
||||
locate('abc', 'a') instr('abc', 'a')
|
||||
0 1
|
||||
select locate('a', 'aaaa', 1), locate('a', 'aaaa', 0), locate('a', 'aaaa', -1);
|
||||
locate('a', 'aaaa', 1) locate('a', 'aaaa', 0) locate('a', 'aaaa', -1)
|
||||
1 0 0
|
||||
select locate('a', 'aaaa', '1.9'), locate('a', 'aaaa', '0.9'), locate('a', 'aaaa', '-1.9');
|
||||
locate('a', 'aaaa', '1.9') locate('a', 'aaaa', '0.9') locate('a', 'aaaa', '-1.9')
|
||||
1 0 0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '0.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.9'
|
||||
select locate('a', 'aaaa', '1.1'), locate('a', 'aaaa', '0.1'), locate('a', 'aaaa', '-1.1');
|
||||
locate('a', 'aaaa', '1.1') locate('a', 'aaaa', '0.1') locate('a', 'aaaa', '-1.1')
|
||||
1 0 0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '0.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.1'
|
||||
select locate('中', 'a中测试', 1);
|
||||
locate('中', 'a中测试', 1)
|
||||
2
|
||||
select locate('a', 'abcdabcd', '2.a');
|
||||
locate('a', 'abcdabcd', '2.a')
|
||||
5
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.a'
|
||||
select locate('a', 'abcdabcd', 'a');
|
||||
locate('a', 'abcdabcd', 'a')
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'a'
|
||||
select locate('a', 'abcdabcd', '-2.a');
|
||||
locate('a', 'abcdabcd', '-2.a')
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.a'
|
||||
select locate('a', 'a', 10000);
|
||||
locate('a', 'a', 10000)
|
||||
0
|
||||
select locate('a', 'a', 1000000000000000000000000000000000000000000000000000000000000000);
|
||||
locate('a', 'a', 1000000000000000000000000000000000000000000000000000000000000000)
|
||||
0
|
||||
select instr('abc', 'a'), instr('aaaa','a'), instr('a中测试', '中'), instr(null, 'a'), instr('a', null);
|
||||
instr('abc', 'a') instr('aaaa','a') instr('a中测试', '中') instr(null, 'a') instr('a', null)
|
||||
1 1 2 NULL NULL
|
||||
select reverse(''), reverse(null), reverse('你好abc中文'), reverse(12345.123), reverse(null);
|
||||
reverse('') reverse(null) reverse('你好abc中文') reverse(12345.123) reverse(null)
|
||||
NULL 文中cba好你 321.54321 NULL
|
||||
drop table if exists t1;
|
||||
create table t1(c1 bigint unsigned);
|
||||
insert into t1 values(locate('a','b',9223372036854775808));
|
||||
select * from t1;
|
||||
c1
|
||||
0
|
||||
drop table t1;
|
||||
@ -0,0 +1,143 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int unsigned,
|
||||
c3 tinyint, c4 tinyint unsigned,
|
||||
c5 bigint, c6 bigint unsigned,
|
||||
c7 float, c8 float unsigned,
|
||||
c9 double, c10 double unsigned,
|
||||
c11 decimal, c12 decimal unsigned,
|
||||
c13 date, c14 datetime, c15 timestamp,
|
||||
c16 varchar(60), c17 char(60));
|
||||
select * from t1;
|
||||
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17
|
||||
insert into t1 values(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
|
||||
insert into t1 values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '');
|
||||
insert into t1 values(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, '0013-01-01', '0014-01-01', '0015-01-01', '16abcDeFG00', '16abcDeFG00');
|
||||
insert into t1 values(-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, '0013-01-01', '0014-01-01 00:00:00', '0015-01-01 00:00:00', '=[]-+,/;<>?.*~!@#$%^&*()', '=[]-+,/;<>?.*~!@#$%^&*()');
|
||||
insert into t1 values(1234567, 7654321, -33, 44, 555555555, 666666666, 777.777, 8888.888, 99999.999999, 10000.00000, 1111, 121212121, '0013-01-01', '0014-01-01 00:00:11', '0015-01-01 00:00:11', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select c1, lower(c1), upper(c1) from t1;
|
||||
c1 lower(c1) upper(c1)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
1 1 1
|
||||
-1 -1 -1
|
||||
1234567 1234567 1234567
|
||||
select c2, lower(c2), upper(c2) from t1;
|
||||
c2 lower(c2) upper(c2)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
2 2 2
|
||||
2 2 2
|
||||
7654321 7654321 7654321
|
||||
select c3, lower(c3), upper(c3) from t1;
|
||||
c3 lower(c3) upper(c3)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
3 3 3
|
||||
-3 -3 -3
|
||||
-33 -33 -33
|
||||
select c4, lower(c4), upper(c4) from t1;
|
||||
c4 lower(c4) upper(c4)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
4 4 4
|
||||
4 4 4
|
||||
44 44 44
|
||||
select c5, lower(c5), upper(c5) from t1;
|
||||
c5 lower(c5) upper(c5)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
5 5 5
|
||||
-5 -5 -5
|
||||
555555555 555555555 555555555
|
||||
select c6, lower(c6), upper(c6) from t1;
|
||||
c6 lower(c6) upper(c6)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
6 6 6
|
||||
6 6 6
|
||||
666666666 666666666 666666666
|
||||
select c7, lower(c7), upper(c7) from t1;
|
||||
c7 lower(c7) upper(c7)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
7 7 7
|
||||
-7 -7 -7
|
||||
777.777 777.777 777.777
|
||||
select c8, lower(c8), upper(c8) from t1;
|
||||
c8 lower(c8) upper(c8)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
8 8 8
|
||||
8 8 8
|
||||
8888.89 8888.89 8888.89
|
||||
select c9, lower(c9), upper(c9) from t1;
|
||||
c9 lower(c9) upper(c9)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
9 9 9
|
||||
-9 -9 -9
|
||||
99999.999999 99999.999999 99999.999999
|
||||
select c10, lower(c10), upper(c10) from t1;
|
||||
c10 lower(c10) upper(c10)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
10 10 10
|
||||
10 10 10
|
||||
10000 10000 10000
|
||||
select c11, lower(c11), upper(c11) from t1;
|
||||
c11 lower(c11) upper(c11)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
11 11 11
|
||||
-11 -11 -11
|
||||
1111 1111 1111
|
||||
select c12, lower(c12), upper(c12) from t1;
|
||||
c12 lower(c12) upper(c12)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
12 12 12
|
||||
12 12 12
|
||||
121212121 121212121 121212121
|
||||
select c13, lower(c13), upper(c13) from t1;
|
||||
c13 lower(c13) upper(c13)
|
||||
NULL NULL NULL
|
||||
0000-00-00 0000-00-00 0000-00-00
|
||||
0013-01-01 0013-01-01 0013-01-01
|
||||
0013-01-01 0013-01-01 0013-01-01
|
||||
0013-01-01 0013-01-01 0013-01-01
|
||||
select c14, lower(c14), upper(c14) from t1;
|
||||
c14 lower(c14) upper(c14)
|
||||
NULL NULL NULL
|
||||
0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
0014-01-01 00:00:00 0014-01-01 00:00:00 0014-01-01 00:00:00
|
||||
0014-01-01 00:00:00 0014-01-01 00:00:00 0014-01-01 00:00:00
|
||||
0014-01-01 00:00:11 0014-01-01 00:00:11 0014-01-01 00:00:11
|
||||
select c15, lower(c15), upper(c15) from t1;
|
||||
c15 lower(c15) upper(c15)
|
||||
NULL NULL NULL
|
||||
0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
0015-01-01 00:00:00 0015-01-01 00:00:00 0015-01-01 00:00:00
|
||||
0015-01-01 00:00:00 0015-01-01 00:00:00 0015-01-01 00:00:00
|
||||
0015-01-01 00:00:11 0015-01-01 00:00:11 0015-01-01 00:00:11
|
||||
select c16, lower(c16), upper(c16) from t1;
|
||||
c16 lower(c16) upper(c16)
|
||||
NULL NULL NULL
|
||||
|
||||
16abcDeFG00 16abcdefg00 16ABCDEFG00
|
||||
=[]-+,/;<>?.*~!@#$%^&*() =[]-+,/;<>?.*~!@#$%^&*() =[]-+,/;<>?.*~!@#$%^&*()
|
||||
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
select c17, lower(c17), upper(c17) from t1;
|
||||
c17 lower(c17) upper(c17)
|
||||
NULL NULL NULL
|
||||
|
||||
16abcDeFG00 16abcdefg00 16ABCDEFG00
|
||||
=[]-+,/;<>?.*~!@#$%^&*() =[]-+,/;<>?.*~!@#$%^&*() =[]-+,/;<>?.*~!@#$%^&*()
|
||||
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
drop table t1;
|
||||
connection conn_admin;
|
||||
@ -0,0 +1,121 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int);
|
||||
drop table if exists t2;
|
||||
create table t2 (c1 int auto_increment primary key, c2 int);
|
||||
drop table if exists t3;
|
||||
create table t3 (c1 int unsigned auto_increment primary key, c2 int);
|
||||
drop table if exists t4;
|
||||
create table t4 (c1 float auto_increment primary key, c2 int);
|
||||
drop table if exists t5;
|
||||
create table t5 (c1 double auto_increment primary key, c2 int);
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
insert into t1 (c1, c2) values (1, 1);
|
||||
insert into t1 (c1, c2) values (1, 1);
|
||||
select * from t1;
|
||||
c1 c2
|
||||
1 1
|
||||
1 1
|
||||
explain insert into t2 (c1, c2) values ('0', '1');
|
||||
Query Plan
|
||||
====================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
------------------------------------
|
||||
|0 |INSERT | |1 |1 |
|
||||
|1 | EXPRESSION| |1 |1 |
|
||||
====================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([column_conv(INT,PS:(11,0),NOT NULL,nextval(16, column_conv(INT,PS:(11,0),NOT NULL,__values.c1)))], [column_conv(INT,PS:(11,0),NULL,__values.c2)]), filter(nil),
|
||||
columns([{t2: ({t2: (t2.c1, t2.c2)})}]), partitions(p0)
|
||||
1 - output([__values.c1], [__values.c2]), filter(nil)
|
||||
values({'0', '1'})
|
||||
|
||||
insert into t2 (c1, c2) values (NULL, '1');
|
||||
insert into t2 (c1, c2) values (0, '2');
|
||||
insert into t2 (c2) values ('3');
|
||||
insert into t2 (c1, c2) values (-5, '4');
|
||||
insert into t2 (c1, c2) values (10, '5');
|
||||
insert into t2 (c1, c2) values (0, '6');
|
||||
insert into t2 (c1, c2) values ('0', '7');
|
||||
insert into t2 (c1, c2) values ('-10', '8');
|
||||
insert into t2 (c1, c2) values (-12.1, '9');
|
||||
insert into t2 (c1, c2) values (-13.9, '10');
|
||||
insert into t2 (c1, c2) values ('abc', '11');
|
||||
ERROR HY000: Incorrect integer value
|
||||
insert into t2 (c1, c2) values (0.0, '12');
|
||||
select * from t2;
|
||||
c1 c2
|
||||
-14 10
|
||||
-12 9
|
||||
-10 8
|
||||
-5 4
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
10 5
|
||||
1000011 6
|
||||
1000012 7
|
||||
1000013 12
|
||||
insert into t3 (c1, c2) values (NULL, '1');
|
||||
insert into t3 (c1, c2) values (-1, '2');
|
||||
ERROR 22003: Out of range value for column
|
||||
insert into t3 (c1, c2) values (0, '3');
|
||||
insert into t3 (c1, c2) values (10, '4');
|
||||
insert into t3 (c1, c2) values (0, '5');
|
||||
select * from t3;
|
||||
c1 c2
|
||||
1 1
|
||||
2 3
|
||||
10 4
|
||||
1000011 5
|
||||
insert into t4 (c1, c2) values (NULL, '1');
|
||||
insert into t4 (c1, c2) values (0, '2');
|
||||
insert into t4 (c1, c2) values ('0', '3');
|
||||
insert into t4 (c1, c2) values (0.0, '4');
|
||||
insert into t4 (c1, c2) values (-10.12, '5');
|
||||
insert into t4 (c1, c2) values (0, '6');
|
||||
insert into t4 (c1, c2) values (10.5, '7');
|
||||
insert into t4 (c1, c2) values (0, '8');
|
||||
select * from t4;
|
||||
c1 c2
|
||||
-10.12 5
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 6
|
||||
10.5 7
|
||||
167784 8
|
||||
insert into t5 (c1, c2) values (NULL, '1');
|
||||
insert into t5 (c1, c2) values (0, '2');
|
||||
insert into t5 (c1, c2) values ('0', '3');
|
||||
insert into t5 (c1, c2) values (0.0, '4');
|
||||
insert into t5 (c1, c2) values (-10.12, '5');
|
||||
insert into t5 (c1, c2) values (0, '6');
|
||||
insert into t5 (c1, c2) values (10.5, '7');
|
||||
insert into t5 (c1, c2) values (0, '8');
|
||||
select * from t5;
|
||||
c1 c2
|
||||
-10.12 5
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 6
|
||||
10.5 7
|
||||
1000012 8
|
||||
set sql_mode = '';
|
||||
insert into t3 (c1, c2) values ("abc", '6');
|
||||
select * from t3;
|
||||
c1 c2
|
||||
1 1
|
||||
2 3
|
||||
10 4
|
||||
1000011 5
|
||||
1000012 6
|
||||
connection syscon;
|
||||
172
test/mysql_test/test_suite/static_engine/r/mysql/expr_not.result
Normal file
172
test/mysql_test/test_suite/static_engine/r/mysql/expr_not.result
Normal file
@ -0,0 +1,172 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
connection default;
|
||||
drop table if exists t;
|
||||
create table t (t1 tinyint,
|
||||
t2 smallint,
|
||||
t3 mediumint,
|
||||
t4 integer,
|
||||
t5 bigint,
|
||||
t6 tinyint unsigned,
|
||||
t7 smallint unsigned,
|
||||
t8 mediumint unsigned,
|
||||
t9 integer unsigned,
|
||||
t10 bigint unsigned,
|
||||
t11 float,
|
||||
t12 float unsigned,
|
||||
t13 double,
|
||||
t14 double unsigned,
|
||||
t15 number,
|
||||
t16 number unsigned,
|
||||
t17 datetime,
|
||||
t18 timestamp,
|
||||
t19 date,
|
||||
t20 time,
|
||||
t21 year,
|
||||
t22 varchar(255),
|
||||
t23 char(255),
|
||||
t24 tinytext,
|
||||
t25 mediumtext,
|
||||
t26 longtext,
|
||||
t27 bit,
|
||||
t28 enum('a', 'b', 'c'),
|
||||
t29 set('a', 'b', 'c'));
|
||||
insert into t values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7,
|
||||
'1993-03-20', '1993-03-20', '1993-03-20', '10:10:10', '1993', '0.8', '0.9', '1.0', '1.1',
|
||||
'1.2', 1, 'b', 'b');
|
||||
insert into t(t1) values (null);
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
connection default;
|
||||
set ob_enable_plan_cache = false;
|
||||
select not 1 from dual;
|
||||
not 1
|
||||
0
|
||||
select not 1.0 from dual;
|
||||
not 1.0
|
||||
0
|
||||
select not null from dual;
|
||||
not null
|
||||
NULL
|
||||
select not 'hello' from dual;
|
||||
not 'hello'
|
||||
1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
|
||||
select not t1 from t;
|
||||
not t1
|
||||
0
|
||||
NULL
|
||||
select not t2 from t;
|
||||
not t2
|
||||
0
|
||||
NULL
|
||||
select not t3 from t;
|
||||
not t3
|
||||
0
|
||||
NULL
|
||||
select not t4 from t;
|
||||
not t4
|
||||
0
|
||||
NULL
|
||||
select not t5 from t;
|
||||
not t5
|
||||
0
|
||||
NULL
|
||||
select not t6 from t;
|
||||
not t6
|
||||
0
|
||||
NULL
|
||||
select not t7 from t;
|
||||
not t7
|
||||
0
|
||||
NULL
|
||||
select not t8 from t;
|
||||
not t8
|
||||
0
|
||||
NULL
|
||||
select not t9 from t;
|
||||
not t9
|
||||
0
|
||||
NULL
|
||||
select not t10 from t;
|
||||
not t10
|
||||
0
|
||||
NULL
|
||||
select not t11 from t;
|
||||
not t11
|
||||
0
|
||||
NULL
|
||||
select not t12 from t;
|
||||
not t12
|
||||
0
|
||||
NULL
|
||||
select not t13 from t;
|
||||
not t13
|
||||
0
|
||||
NULL
|
||||
select not t14 from t;
|
||||
not t14
|
||||
0
|
||||
NULL
|
||||
select not t15 from t;
|
||||
not t15
|
||||
0
|
||||
NULL
|
||||
select not t16 from t;
|
||||
not t16
|
||||
0
|
||||
NULL
|
||||
select not t17 from t;
|
||||
not t17
|
||||
0
|
||||
NULL
|
||||
select not t18 from t;
|
||||
not t18
|
||||
0
|
||||
NULL
|
||||
select not t19 from t;
|
||||
not t19
|
||||
0
|
||||
NULL
|
||||
select not t20 from t;
|
||||
not t20
|
||||
0
|
||||
NULL
|
||||
select not t21 from t;
|
||||
not t21
|
||||
0
|
||||
NULL
|
||||
select not t22 from t;
|
||||
not t22
|
||||
0
|
||||
NULL
|
||||
select not t23 from t;
|
||||
not t23
|
||||
0
|
||||
NULL
|
||||
select not t24 from t;
|
||||
not t24
|
||||
0
|
||||
NULL
|
||||
select not t25 from t;
|
||||
not t25
|
||||
0
|
||||
NULL
|
||||
select not t26 from t;
|
||||
not t26
|
||||
0
|
||||
NULL
|
||||
select not t27 from t;
|
||||
not t27
|
||||
0
|
||||
NULL
|
||||
select not t28 from t;
|
||||
not t28
|
||||
0
|
||||
NULL
|
||||
select not t29 from t;
|
||||
not t29
|
||||
0
|
||||
NULL
|
||||
File diff suppressed because it is too large
Load Diff
3917
test/mysql_test/test_suite/static_engine/r/mysql/expr_nvl.result
Normal file
3917
test/mysql_test/test_suite/static_engine/r/mysql/expr_nvl.result
Normal file
File diff suppressed because it is too large
Load Diff
3267
test/mysql_test/test_suite/static_engine/r/mysql/expr_pad.result
Normal file
3267
test/mysql_test/test_suite/static_engine/r/mysql/expr_pad.result
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,25 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 bigint, c3 decimal);
|
||||
insert into t1 (c1, c2, c3) values (1, NULL, 1);
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select c1, partition_hash(c1) from t1;
|
||||
c1 partition_hash(c1)
|
||||
1 1
|
||||
select c2, partition_hash(c2) from t1;
|
||||
c2 partition_hash(c2)
|
||||
NULL 0
|
||||
select c3, partition_hash(c3) from t1;
|
||||
ERROR HY000: The PARTITION function returns the wrong type
|
||||
select partition_hash(c1, c2) from t1;
|
||||
ERROR HY000: Internal error
|
||||
select partition_hash(10) from t1;
|
||||
partition_hash(10)
|
||||
10
|
||||
select partition_hash(-10) from t1;
|
||||
partition_hash(-10)
|
||||
10
|
||||
connection syscon;
|
||||
@ -0,0 +1,76 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 bigint, c3 decimal, c4 char(20), c5 varchar(20), c6 date, c7 datetime, c8 timestamp);
|
||||
insert into t1 (c1, c2, c3, c4, c5, c6, c7, c8) values (1, NULL, 1, "abc ", "abc ", '2020-01-01', '2020-01-01 01:01:01', '2020-01-01 01:01:01');
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select c1, partition_key(c1) from t1;
|
||||
c1 partition_key(c1)
|
||||
1 294837134935570197
|
||||
select c2, partition_key(c2) from t1;
|
||||
c2 partition_key(c2)
|
||||
NULL 6960269033020761575
|
||||
select c3, partition_key(c3) from t1;
|
||||
c3 partition_key(c3)
|
||||
1 4095890315155992887
|
||||
select c4, partition_key(c4) from t1;
|
||||
c4 partition_key(c4)
|
||||
abc 1801346201538688951
|
||||
select c5, partition_key(c5) from t1;
|
||||
c5 partition_key(c5)
|
||||
abc 1801346201538688951
|
||||
select c6, partition_key(c6) from t1;
|
||||
c6 partition_key(c6)
|
||||
2020-01-01 3780289746228831367
|
||||
select c7, partition_key(c7) from t1;
|
||||
c7 partition_key(c7)
|
||||
2020-01-01 01:01:01 6488855144877179734
|
||||
select c8, partition_key(c8) from t1;
|
||||
c8 partition_key(c8)
|
||||
2020-01-01 01:01:01 6375794890780556234
|
||||
select partition_key(c1, c2) from t1;
|
||||
partition_key(c1, c2)
|
||||
319562542098195289
|
||||
select partition_key(c1, c2, c3) from t1;
|
||||
partition_key(c1, c2, c3)
|
||||
3093204954362125526
|
||||
select partition_key(c1, c3) from t1;
|
||||
partition_key(c1, c3)
|
||||
9006715823204485749
|
||||
select c1, partition_key_v2(c1) from t1;
|
||||
c1 partition_key_v2(c1)
|
||||
1 8089716718896805586
|
||||
select c2, partition_key_v2(c2) from t1;
|
||||
c2 partition_key_v2(c2)
|
||||
NULL 6960269033020761575
|
||||
select c3, partition_key_v2(c3) from t1;
|
||||
c3 partition_key_v2(c3)
|
||||
1 5958971315933813165
|
||||
select c4, partition_key_v2(c4) from t1;
|
||||
c4 partition_key_v2(c4)
|
||||
abc 258901174748407223
|
||||
select c5, partition_key_v2(c5) from t1;
|
||||
c5 partition_key_v2(c5)
|
||||
abc 258901174748407223
|
||||
select c6, partition_key_v2(c6) from t1;
|
||||
c6 partition_key_v2(c6)
|
||||
2020-01-01 5558489265225801925
|
||||
select c7, partition_key_v2(c7) from t1;
|
||||
c7 partition_key_v2(c7)
|
||||
2020-01-01 01:01:01 3406840642020255355
|
||||
select c8, partition_key_v2(c8) from t1;
|
||||
c8 partition_key_v2(c8)
|
||||
2020-01-01 01:01:01 8121525409574338685
|
||||
select partition_key_v2(c1, c2) from t1;
|
||||
partition_key_v2(c1, c2)
|
||||
3042015303219230768
|
||||
select partition_key_v2(c1, c2, c3) from t1;
|
||||
partition_key_v2(c1, c2, c3)
|
||||
2899520937750054785
|
||||
select partition_key_v2(c1, c3) from t1;
|
||||
partition_key_v2(c1, c3)
|
||||
4685265492491719863
|
||||
connection syscon;
|
||||
@ -0,0 +1,42 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 varchar(50), c2 varchar(50));
|
||||
insert into t1 (c1, c2) values ('abc1', '^abc[0-9]?$');
|
||||
insert into t1 (c1, c2) values ('abc1', '^abd');
|
||||
drop table if exists t2;
|
||||
create table t2 (a varchar(50));
|
||||
insert into t2 values ("abc1");
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select 'abcdef' regexp '^abc.*';
|
||||
'abcdef' regexp '^abc.*'
|
||||
1
|
||||
select 'abcdef' regexp '^abd.*';
|
||||
'abcdef' regexp '^abd.*'
|
||||
0
|
||||
select '' regexp '^$';
|
||||
'' regexp '^$'
|
||||
1
|
||||
select 'a' regexp '';
|
||||
ERROR 42000: Got error 'empty (sub)expression' from regexp
|
||||
select NULL regexp 'a';
|
||||
NULL regexp 'a'
|
||||
NULL
|
||||
select 'a' regexp NULL;
|
||||
'a' regexp NULL
|
||||
NULL
|
||||
select c2, c2 regexp 'abc' from t1;
|
||||
c2 c2 regexp 'abc'
|
||||
^abc[0-9]?$ 1
|
||||
^abd 0
|
||||
select c2, (select a regexp c2 from t2) from t1;
|
||||
c2 (select a regexp c2 from t2)
|
||||
^abc[0-9]?$ 1
|
||||
^abd 0
|
||||
select c1, c2, c1 regexp c2 from t1;
|
||||
c1 c2 c1 regexp c2
|
||||
abc1 ^abc[0-9]?$ 1
|
||||
abc1 ^abd 0
|
||||
connection syscon;
|
||||
@ -0,0 +1,165 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select regexp_like('abc', 'a.*') from dual;
|
||||
regexp_like('abc', 'a.*')
|
||||
1
|
||||
select regexp_like('abc', 'a.* ') from dual;
|
||||
regexp_like('abc', 'a.* ')
|
||||
0
|
||||
select regexp_like('abc', 'a.* ', NULL) from dual;
|
||||
regexp_like('abc', 'a.* ', NULL)
|
||||
NULL
|
||||
select regexp_like('abc', 'a.* ', 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_like('abc', NULL) from dual;
|
||||
regexp_like('abc', NULL)
|
||||
NULL
|
||||
select regexp_like(NULL, 'a.*') from dual;
|
||||
regexp_like(NULL, 'a.*')
|
||||
NULL
|
||||
select regexp_like(123, 123) from dual;
|
||||
regexp_like(123, 123)
|
||||
1
|
||||
select regexp_like('我是好人', '.是.*') from dual;
|
||||
regexp_like('我是好人', '.是.*')
|
||||
1
|
||||
select regexp_instr('abcadef', 'a.') from dual;
|
||||
regexp_instr('abcadef', 'a.')
|
||||
1
|
||||
select regexp_instr('abcadef', 'a.', 1, 2) from dual;
|
||||
regexp_instr('abcadef', 'a.', 1, 2)
|
||||
4
|
||||
select regexp_instr('abcadef', 'a.', 1, 2, 0) from dual;
|
||||
regexp_instr('abcadef', 'a.', 1, 2, 0)
|
||||
4
|
||||
select regexp_instr('abcadef', 'a.', 1, 2, 1) from dual;
|
||||
regexp_instr('abcadef', 'a.', 1, 2, 1)
|
||||
6
|
||||
select regexp_instr('abcadef', 'a.', 0, 2, 1) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', 'a.', 1, 0, 1) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', 'a.', 1, 2, -1) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', 'a.', 100, 2) from dual;
|
||||
regexp_instr('abcadef', 'a.', 100, 2)
|
||||
0
|
||||
select regexp_instr('abcadef', 'a.', 1, 200) from dual;
|
||||
regexp_instr('abcadef', 'a.', 1, 200)
|
||||
0
|
||||
select regexp_instr('abcadef', 'a. ', 1, 2, 1, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('', 'a. ', 1, 2, 1, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', '', 1, 2, 1, 'x') from dual;
|
||||
ERROR 42000: Got error 'empty (sub)expression' from regexp
|
||||
select regexp_instr('abcadef', 'a. ', NULL, 2, 1, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', 'a. ', 1, NULL, 1, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', 'a. ', 1, 2, NULL, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', 'a. ', 1, 2, 1, NULL) from dual;
|
||||
regexp_instr('abcadef', 'a. ', 1, 2, 1, NULL)
|
||||
NULL
|
||||
select regexp_instr(12341834, 1.3, '1', '2', 1) from dual;
|
||||
regexp_instr(12341834, 1.3, '1', '2', 1)
|
||||
8
|
||||
select regexp_instr('我是好人', '是.') from dual;
|
||||
regexp_instr('我是好人', '是.')
|
||||
2
|
||||
select regexp_substr('abcadef', 'a.', 1) from dual;
|
||||
regexp_substr('abcadef', 'a.', 1)
|
||||
ab
|
||||
select regexp_substr('abcadef', 'a.', 1, 2) from dual;
|
||||
regexp_substr('abcadef', 'a.', 1, 2)
|
||||
ad
|
||||
select regexp_substr('abcadef', 'a.', 0, 2) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_substr('abcadef', 'a.', 1, 0) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_substr('abcadef', 'a.', 10, 2) from dual;
|
||||
regexp_substr('abcadef', 'a.', 10, 2)
|
||||
NULL
|
||||
select regexp_substr('abcadef', 'a.', 1, 10) from dual;
|
||||
regexp_substr('abcadef', 'a.', 1, 10)
|
||||
NULL
|
||||
select regexp_substr('abcadef', 'a. ', 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_substr('', 'a. ', 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_substr('abcadef', '', 1, 2, 'x') from dual;
|
||||
ERROR 42000: Got error 'empty (sub)expression' from regexp
|
||||
select regexp_substr('abcadef', 'a. ', NULL, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_substr('abcadef', 'a. ', 1, NULL, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_substr('abcadef', 'a. ', 1, 2, NULL) from dual;
|
||||
regexp_substr('abcadef', 'a. ', 1, 2, NULL)
|
||||
NULL
|
||||
select regexp_substr(12341834, 1.3, '1.9', '2') from dual;
|
||||
regexp_substr(12341834, 1.3, '1.9', '2')
|
||||
183
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.9'
|
||||
select regexp_replace('我是好人', '是.') from dual;
|
||||
regexp_replace('我是好人', '是.')
|
||||
我人
|
||||
select regexp_replace('abcadef', 'a.') from dual;
|
||||
regexp_replace('abcadef', 'a.')
|
||||
cef
|
||||
select regexp_replace('abcadef', 'a.*') from dual;
|
||||
regexp_replace('abcadef', 'a.*')
|
||||
|
||||
select regexp_replace('abcadef', 'a.', 'X') from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X')
|
||||
XcXef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 1) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 1)
|
||||
XcXef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 1, 2) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 1, 2)
|
||||
abcXef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 2, 1) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 2, 1)
|
||||
abcXef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 2, 2) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 2, 2)
|
||||
abcadef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 1, 0) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 1, 0)
|
||||
XcXef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 1, -1) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_replace('abcadef', 'a.', 'X', 10, 2) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 10, 2)
|
||||
abcadef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 1, 100) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 1, 100)
|
||||
abcadef
|
||||
select regexp_replace('abcadef', 'a. ', 'X', 1, 2) from dual;
|
||||
regexp_replace('abcadef', 'a. ', 'X', 1, 2)
|
||||
abcadef
|
||||
select regexp_replace('abcadef', 'a. ', 'X', 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_replace('', 'a. ', 'X', 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_replace('abcadef', '', 'X', 1, 2, 'x') from dual;
|
||||
ERROR 42000: Got error 'empty (sub)expression' from regexp
|
||||
select regexp_replace('abcadef', 'a. ', NULL, 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_replace('abcadef', 'a. ', 'X', NULL, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_replace('abcadef', 'a. ', 'X', 1, NULL, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_replace('abcadef', 'a. ', 'X', 1, 2, NULL) from dual;
|
||||
regexp_replace('abcadef', 'a. ', 'X', 1, 2, NULL)
|
||||
NULL
|
||||
select regexp_replace(12341834, 1.3, 99, '1', '2') from dual;
|
||||
regexp_replace(12341834, 1.3, 99, '1', '2')
|
||||
1234994
|
||||
select regexp_replace('我是好人', '是.', '.....') from dual;
|
||||
regexp_replace('我是好人', '是.', '.....')
|
||||
我.....人
|
||||
connection syscon;
|
||||
@ -0,0 +1,44 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select repeat("abc", -1);
|
||||
repeat("abc", -1)
|
||||
|
||||
select repeat("abc", 0);
|
||||
repeat("abc", 0)
|
||||
|
||||
select repeat("abc", 1);
|
||||
repeat("abc", 1)
|
||||
abc
|
||||
select repeat("abc", 2);
|
||||
repeat("abc", 2)
|
||||
abcabc
|
||||
select repeat("abc", 3);
|
||||
repeat("abc", 3)
|
||||
abcabcabc
|
||||
select repeat("abc", "2.1");
|
||||
repeat("abc", "2.1")
|
||||
abcabc
|
||||
select repeat("abc", "2.9");
|
||||
repeat("abc", "2.9")
|
||||
abcabc
|
||||
select repeat("", 2);
|
||||
repeat("", 2)
|
||||
|
||||
select repeat(NULL, 2);
|
||||
repeat(NULL, 2)
|
||||
NULL
|
||||
select repeat("abc", NULL);
|
||||
repeat("abc", NULL)
|
||||
NULL
|
||||
select repeat(1.414, 1);
|
||||
repeat(1.414, 1)
|
||||
1.414
|
||||
select repeat(1.414, 2);
|
||||
repeat(1.414, 2)
|
||||
1.4141.414
|
||||
select repeat("abc", 200000000);
|
||||
repeat("abc", 200000000)
|
||||
NULL
|
||||
connection syscon;
|
||||
@ -0,0 +1,33 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select replace('abcdbf', 'b', 'cc');
|
||||
replace('abcdbf', 'b', 'cc')
|
||||
acccdccf
|
||||
select replace('abcdbf', 'b');
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'replace'
|
||||
select replace('abcdbf', 'b', '');
|
||||
replace('abcdbf', 'b', '')
|
||||
acdf
|
||||
select replace('abcdbf', '', 'cc');
|
||||
replace('abcdbf', '', 'cc')
|
||||
abcdbf
|
||||
select replace('', 'b', 'cc');
|
||||
replace('', 'b', 'cc')
|
||||
|
||||
select replace(NULL, 'b', 'cc');
|
||||
replace(NULL, 'b', 'cc')
|
||||
NULL
|
||||
select replace('abcdbf', NULL, 'cc');
|
||||
replace('abcdbf', NULL, 'cc')
|
||||
NULL
|
||||
select replace('abcdbf', 'b', NULL);
|
||||
replace('abcdbf', 'b', NULL)
|
||||
NULL
|
||||
select replace('abc', 'abc', '');
|
||||
replace('abc', 'abc', '')
|
||||
|
||||
connection syscon;
|
||||
@ -0,0 +1,746 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (c1 int, c2 int unsigned,
|
||||
c3 tinyint, c4 tinyint unsigned,
|
||||
c5 smallint, c6 smallint unsigned,
|
||||
c7 mediumint, c8 mediumint unsigned,
|
||||
c9 integer, c10 integer unsigned,
|
||||
c11 bigint, c12 bigint unsigned,
|
||||
c13 float, c14 float unsigned,
|
||||
c15 double, c16 double unsigned,
|
||||
c17 decimal, c18 decimal unsigned,
|
||||
c19 datetime, c20 timestamp,
|
||||
c21 varchar(30), c22 char(30), c_null int);
|
||||
insert into t1 values(1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
3.5, 4.5,
|
||||
5.5, 6.5,
|
||||
7.5, 8.5,
|
||||
'2019-12-01 12:00:00', '2019-12-03 06:00:00',
|
||||
'9.5', '10.5', null);
|
||||
insert into t1 values(-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-3.5, 4.5,
|
||||
-5.5, 6.5,
|
||||
-7.5, 8.5,
|
||||
'2019-12-01 12:00:00', '2019-12-03 06:00:00',
|
||||
'-9.5', '10.5', null);
|
||||
create table t2(
|
||||
a1 char(3) primary key,
|
||||
a2 int,
|
||||
a3 char(3),
|
||||
a4 float,
|
||||
a5 datetime
|
||||
);
|
||||
insert into t2 values('AME',0,'SEA',0.100,date'1942-02-19');
|
||||
insert into t2 values('HBR',1,'SEA',0.085,date'1948-03-05');
|
||||
insert into t2 values('BOT',-2,'SEA',-0.085,date'1951-11-29');
|
||||
insert into t2 values('BMC',3,'SEA',-0.085,date'1958-09-08');
|
||||
insert into t2 values('TWU',+0,'LAX',-0.080,date'1969-10-05');
|
||||
insert into t2 values('BDL',-0,'DEN',-0.080,date'1960-11-27');
|
||||
insert into t2 values('DTX',1,'NYC',0.080,date'1961-05-04');
|
||||
insert into t2 values('PLS',-1,'WDC',-0.075,date'1949-01-02');
|
||||
insert into t2 values('ZAJ',2,'CHI',-0.075,date'1960-06-15');
|
||||
insert into t2 values('VVV',-2,'MON',0.075,date'1959-06-28');
|
||||
insert into t2 values('GTM',3,'DAL',-0.070,date'1977-09-23');
|
||||
insert into t2 values('SSJ',null,'CHI',null,date'1974-03-19');
|
||||
insert into t2 values('KKK',-3,'ATL',null,null);
|
||||
insert into t2 values('XXX',null,'MIN',null,null);
|
||||
insert into t2 values('WWW',1,'LED',null,null);
|
||||
insert into t2 values('GG3',-3,'DD3',-0.051,date'1974-03-19');
|
||||
insert into t2 values('GG2',-3,'DD2',0.052,date'1974-03-19');
|
||||
insert into t2 values('GG1',3,'DD1',0.053,date'1974-03-19');
|
||||
select sign(null) from dual;
|
||||
sign(null)
|
||||
NULL
|
||||
select c1, sign(c1) from t1;
|
||||
c1 sign(c1)
|
||||
1 1
|
||||
-1 -1
|
||||
select c2, sign(c2) from t1;
|
||||
c2 sign(c2)
|
||||
2 1
|
||||
2 1
|
||||
select c3, sign(c3) from t1;
|
||||
c3 sign(c3)
|
||||
1 1
|
||||
-1 -1
|
||||
select c4, sign(c4) from t1;
|
||||
c4 sign(c4)
|
||||
2 1
|
||||
2 1
|
||||
select c5, sign(c5) from t1;
|
||||
c5 sign(c5)
|
||||
1 1
|
||||
-1 -1
|
||||
select c6, sign(c6) from t1;
|
||||
c6 sign(c6)
|
||||
2 1
|
||||
2 1
|
||||
select c7, sign(c7) from t1;
|
||||
c7 sign(c7)
|
||||
1 1
|
||||
-1 -1
|
||||
select c8, sign(c8) from t1;
|
||||
c8 sign(c8)
|
||||
2 1
|
||||
2 1
|
||||
select c9, sign(c9) from t1;
|
||||
c9 sign(c9)
|
||||
1 1
|
||||
-1 -1
|
||||
select c10, sign(c10) from t1;
|
||||
c10 sign(c10)
|
||||
2 1
|
||||
2 1
|
||||
select c11, sign(c11) from t1;
|
||||
c11 sign(c11)
|
||||
1 1
|
||||
-1 -1
|
||||
select c12, sign(c12) from t1;
|
||||
c12 sign(c12)
|
||||
2 1
|
||||
2 1
|
||||
select c13, sign(c13) from t1;
|
||||
c13 sign(c13)
|
||||
3.5 1
|
||||
-3.5 -1
|
||||
select c14, sign(c14) from t1;
|
||||
c14 sign(c14)
|
||||
4.5 1
|
||||
4.5 1
|
||||
select c15, sign(c15) from t1;
|
||||
c15 sign(c15)
|
||||
5.5 1
|
||||
-5.5 -1
|
||||
select c16, sign(c16) from t1;
|
||||
c16 sign(c16)
|
||||
6.5 1
|
||||
6.5 1
|
||||
select c17, sign(c17) from t1;
|
||||
c17 sign(c17)
|
||||
8 1
|
||||
-8 -1
|
||||
select c18, sign(c18) from t1;
|
||||
c18 sign(c18)
|
||||
9 1
|
||||
9 1
|
||||
select c19, sign(c19) from t1;
|
||||
c19 sign(c19)
|
||||
2019-12-01 12:00:00 1
|
||||
2019-12-01 12:00:00 1
|
||||
select c20, sign(c20) from t1;
|
||||
c20 sign(c20)
|
||||
2019-12-03 06:00:00 1
|
||||
2019-12-03 06:00:00 1
|
||||
select c21, sign(c21) from t1;
|
||||
c21 sign(c21)
|
||||
9.5 1
|
||||
-9.5 -1
|
||||
select c22, sign(c22) from t1;
|
||||
c22 sign(c22)
|
||||
10.5 1
|
||||
10.5 1
|
||||
select sign(a1) from t2;
|
||||
sign(a1)
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'AME'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BDL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BMC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BOT'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DTX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GTM'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'HBR'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'KKK'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'PLS'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SSJ'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'TWU'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'VVV'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WWW'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'XXX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ZAJ'
|
||||
select sign(a3) from t2;
|
||||
sign(a3)
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DEN'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'NYC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DAL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ATL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WDC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'CHI'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'LAX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'MON'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'LED'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'MIN'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'CHI'
|
||||
select sign(a1),a2 from t2;
|
||||
sign(a1) a2
|
||||
0 0
|
||||
0 0
|
||||
0 3
|
||||
0 -2
|
||||
0 1
|
||||
0 3
|
||||
0 -3
|
||||
0 -3
|
||||
0 3
|
||||
0 1
|
||||
0 -3
|
||||
0 -1
|
||||
0 NULL
|
||||
0 0
|
||||
0 -2
|
||||
0 1
|
||||
0 NULL
|
||||
0 2
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'AME'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BDL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BMC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BOT'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DTX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GTM'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'HBR'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'KKK'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'PLS'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SSJ'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'TWU'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'VVV'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WWW'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'XXX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ZAJ'
|
||||
select sign(a2) from t2 where sign(a4) >= 0;
|
||||
sign(a2)
|
||||
0
|
||||
1
|
||||
1
|
||||
-1
|
||||
1
|
||||
-1
|
||||
select sign(a4) from t2 where sign(a2) <=0 AND a2 < 2;
|
||||
sign(a4)
|
||||
1
|
||||
-1
|
||||
-1
|
||||
1
|
||||
-1
|
||||
NULL
|
||||
-1
|
||||
-1
|
||||
1
|
||||
select * from t2 group by sign(a2);
|
||||
a1 a2 a3 a4 a5
|
||||
AME 0 SEA 0.1 timestamp
|
||||
BMC 3 SEA -0.085 timestamp
|
||||
BOT -2 SEA -0.085 timestamp
|
||||
SSJ NULL CHI NULL timestamp
|
||||
select * from t2 order by sign(a4) ;
|
||||
a1 a2 a3 a4 a5
|
||||
XXX NULL MIN NULL timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
SSJ NULL CHI NULL timestamp
|
||||
KKK -3 ATL NULL timestamp
|
||||
BDL 0 DEN -0.08 timestamp
|
||||
ZAJ 2 CHI -0.075 timestamp
|
||||
TWU 0 LAX -0.08 timestamp
|
||||
PLS -1 WDC -0.075 timestamp
|
||||
GTM 3 DAL -0.07 timestamp
|
||||
GG3 -3 DD3 -0.051 timestamp
|
||||
BOT -2 SEA -0.085 timestamp
|
||||
BMC 3 SEA -0.085 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
GG2 -3 DD2 0.052 timestamp
|
||||
GG1 3 DD1 0.053 timestamp
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
VVV -2 MON 0.075 timestamp
|
||||
AME 0 SEA 0.1 timestamp
|
||||
select * from t2 order by sign(a4) , a4 ;
|
||||
a1 a2 a3 a4 a5
|
||||
XXX NULL MIN NULL timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
SSJ NULL CHI NULL timestamp
|
||||
KKK -3 ATL NULL timestamp
|
||||
BMC 3 SEA -0.085 timestamp
|
||||
BOT -2 SEA -0.085 timestamp
|
||||
BDL 0 DEN -0.08 timestamp
|
||||
TWU 0 LAX -0.08 timestamp
|
||||
ZAJ 2 CHI -0.075 timestamp
|
||||
PLS -1 WDC -0.075 timestamp
|
||||
GTM 3 DAL -0.07 timestamp
|
||||
GG3 -3 DD3 -0.051 timestamp
|
||||
GG2 -3 DD2 0.052 timestamp
|
||||
GG1 3 DD1 0.053 timestamp
|
||||
VVV -2 MON 0.075 timestamp
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
AME 0 SEA 0.1 timestamp
|
||||
select * from t2 order by sign(a4) , a1 ;
|
||||
a1 a2 a3 a4 a5
|
||||
KKK -3 ATL NULL timestamp
|
||||
SSJ NULL CHI NULL timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
XXX NULL MIN NULL timestamp
|
||||
BDL 0 DEN -0.08 timestamp
|
||||
BMC 3 SEA -0.085 timestamp
|
||||
BOT -2 SEA -0.085 timestamp
|
||||
GG3 -3 DD3 -0.051 timestamp
|
||||
GTM 3 DAL -0.07 timestamp
|
||||
PLS -1 WDC -0.075 timestamp
|
||||
TWU 0 LAX -0.08 timestamp
|
||||
ZAJ 2 CHI -0.075 timestamp
|
||||
AME 0 SEA 0.1 timestamp
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
GG1 3 DD1 0.053 timestamp
|
||||
GG2 -3 DD2 0.052 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
VVV -2 MON 0.075 timestamp
|
||||
select abs(a2) , sum(a4) from t2 group by abs(a2) having sum(sign(a4)) > 0;
|
||||
abs(a2) sum(a4)
|
||||
1 0.08999999612569809
|
||||
select * from t2 where a2 = sign ( floor(1.5) - ceil(1.5) + round(1.5) - abs(-1.5) + neg(-1) );
|
||||
a1 a2 a3 a4 a5
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
select sign( sum(a2) ) , sign( sum(a4) ) from t2;
|
||||
sign( sum(a2) ) sign( sum(a4) )
|
||||
0 -1
|
||||
select sign( avg(a2) ) , sign( avg(a4) ) from t2;
|
||||
sign( avg(a2) ) sign( avg(a4) )
|
||||
0 -1
|
||||
select sign( max(a2) ) , sign( min(a4) ) from t2;
|
||||
sign( max(a2) ) sign( min(a4) )
|
||||
1 -1
|
||||
select sign(count(*)) from t2;
|
||||
sign(count(*))
|
||||
1
|
||||
select * from t2 where sign( length(a1) ) = 1;
|
||||
a1 a2 a3 a4 a5
|
||||
AME 0 SEA 0.1 timestamp
|
||||
BDL 0 DEN -0.08 timestamp
|
||||
BMC 3 SEA -0.085 timestamp
|
||||
BOT -2 SEA -0.085 timestamp
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
GG1 3 DD1 0.053 timestamp
|
||||
GG2 -3 DD2 0.052 timestamp
|
||||
GG3 -3 DD3 -0.051 timestamp
|
||||
GTM 3 DAL -0.07 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
KKK -3 ATL NULL timestamp
|
||||
PLS -1 WDC -0.075 timestamp
|
||||
SSJ NULL CHI NULL timestamp
|
||||
TWU 0 LAX -0.08 timestamp
|
||||
VVV -2 MON 0.075 timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
XXX NULL MIN NULL timestamp
|
||||
ZAJ 2 CHI -0.075 timestamp
|
||||
select sign( cast(a1 as char(1024)) ) , sign( cast(a3 as char(1024)) ) from t2;
|
||||
sign( cast(a1 as char(1024)) ) sign( cast(a3 as char(1024)) )
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'AME'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BDL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DEN'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BMC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BOT'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DTX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'NYC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GTM'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DAL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'HBR'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'KKK'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ATL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'PLS'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WDC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SSJ'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'CHI'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'TWU'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'LAX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'VVV'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'MON'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WWW'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'LED'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'XXX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'MIN'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ZAJ'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'CHI'
|
||||
select sign( cast(a2 as char(1024)) ) , sign( cast(a4 as char(1024)) ) from t2;
|
||||
sign( cast(a2 as char(1024)) ) sign( cast(a4 as char(1024)) )
|
||||
0 1
|
||||
0 -1
|
||||
1 -1
|
||||
-1 -1
|
||||
1 1
|
||||
1 1
|
||||
-1 1
|
||||
-1 -1
|
||||
1 -1
|
||||
1 1
|
||||
-1 NULL
|
||||
-1 -1
|
||||
NULL NULL
|
||||
0 -1
|
||||
-1 1
|
||||
1 NULL
|
||||
NULL NULL
|
||||
1 -1
|
||||
select * from t2 as t21 join t2 as t22 on sign(t21.a2) = sign(t22.a4);
|
||||
a1 a2 a3 a4 a5 a1 a2 a3 a4 a5
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00 AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
WWW 1 LED NULL NULL AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00 AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00 AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00 AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00 AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00 AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
KKK -3 ATL NULL NULL BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
KKK -3 ATL NULL NULL BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
KKK -3 ATL NULL NULL BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00 DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
WWW 1 LED NULL NULL DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00 DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00 DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00 DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00 DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00 DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00 GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
WWW 1 LED NULL NULL GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00 GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00 GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00 GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00 GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00 GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00 GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
WWW 1 LED NULL NULL GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00 GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00 GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00 GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00 GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00 GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
KKK -3 ATL NULL NULL GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
KKK -3 ATL NULL NULL GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00 HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
WWW 1 LED NULL NULL HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00 HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00 HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00 HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00 HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00 HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
KKK -3 ATL NULL NULL PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
KKK -3 ATL NULL NULL TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00 VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
WWW 1 LED NULL NULL VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00 VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00 VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00 VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00 VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00 VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
KKK -3 ATL NULL NULL ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
select tmp.a1 , sign(tmp.a2) , tmp.a3 , sign(tmp.a4) from t2 as tmp;
|
||||
a1 sign(tmp.a2) a3 sign(tmp.a4)
|
||||
AME 0 SEA 1
|
||||
BDL 0 DEN -1
|
||||
BMC 1 SEA -1
|
||||
BOT -1 SEA -1
|
||||
DTX 1 NYC 1
|
||||
GG1 1 DD1 1
|
||||
GG2 -1 DD2 1
|
||||
GG3 -1 DD3 -1
|
||||
GTM 1 DAL -1
|
||||
HBR 1 SEA 1
|
||||
KKK -1 ATL NULL
|
||||
PLS -1 WDC -1
|
||||
SSJ NULL CHI NULL
|
||||
TWU 0 LAX -1
|
||||
VVV -1 MON 1
|
||||
WWW 1 LED NULL
|
||||
XXX NULL MIN NULL
|
||||
ZAJ 1 CHI -1
|
||||
select sign(a2) from t2 where sign(a4) >= 0 for update;
|
||||
sign(a2)
|
||||
0
|
||||
1
|
||||
1
|
||||
-1
|
||||
1
|
||||
-1
|
||||
select sign(a4) from t2 where sign(a2) <=0 AND a2 < 2 for update;
|
||||
sign(a4)
|
||||
1
|
||||
-1
|
||||
-1
|
||||
1
|
||||
-1
|
||||
NULL
|
||||
-1
|
||||
-1
|
||||
1
|
||||
select * from t2 group by sign(a2) for update;
|
||||
a1 a2 a3 a4 a5
|
||||
AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
SSJ NULL CHI NULL 1974-03-19 00:00:00
|
||||
select * from t2 order by sign(a4) for update;
|
||||
a1 a2 a3 a4 a5
|
||||
XXX NULL MIN NULL NULL
|
||||
WWW 1 LED NULL NULL
|
||||
SSJ NULL CHI NULL 1974-03-19 00:00:00
|
||||
KKK -3 ATL NULL NULL
|
||||
BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
select abs(a2) , sum(a4) from t2 group by abs(a2) having sum(sign(a4)) > 0 for update;
|
||||
abs(a2) sum(a4)
|
||||
1 0.08999999612569809
|
||||
select * from t2 where a2 = sign ( floor(1.5) - ceil(1.5) + round(1.5) - abs(-1.5) + neg(-1) ) for update;
|
||||
a1 a2 a3 a4 a5
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
select sign( sum(a2) ) , sign( sum(a4) ) from t2 for update;
|
||||
sign( sum(a2) ) sign( sum(a4) )
|
||||
0 -1
|
||||
select sign( avg(a2) ) , sign( avg(a4) ) from t2 for update;
|
||||
sign( avg(a2) ) sign( avg(a4) )
|
||||
0 -1
|
||||
select sign( max(a2) ) , sign( min(a4) ) from t2 for update;
|
||||
sign( max(a2) ) sign( min(a4) )
|
||||
1 -1
|
||||
select sign(count(*)) from t2 for update;
|
||||
sign(count(*))
|
||||
1
|
||||
select * from t2 where sign( length(a1) ) = 1 for update;
|
||||
a1 a2 a3 a4 a5
|
||||
AME 0 SEA 0.1 timestamp
|
||||
BDL 0 DEN -0.08 timestamp
|
||||
BMC 3 SEA -0.085 timestamp
|
||||
BOT -2 SEA -0.085 timestamp
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
GG1 3 DD1 0.053 timestamp
|
||||
GG2 -3 DD2 0.052 timestamp
|
||||
GG3 -3 DD3 -0.051 timestamp
|
||||
GTM 3 DAL -0.07 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
KKK -3 ATL NULL timestamp
|
||||
PLS -1 WDC -0.075 timestamp
|
||||
SSJ NULL CHI NULL timestamp
|
||||
TWU 0 LAX -0.08 timestamp
|
||||
VVV -2 MON 0.075 timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
XXX NULL MIN NULL timestamp
|
||||
ZAJ 2 CHI -0.075 timestamp
|
||||
select sign( cast(a1 as char(1024)) ) , sign( cast(a3 as char(1024)) ) from t2 for update;
|
||||
sign( cast(a1 as char(1024)) ) sign( cast(a3 as char(1024)) )
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'AME'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BDL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DEN'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BMC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BOT'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DTX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'NYC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GTM'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DAL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'HBR'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'KKK'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ATL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'PLS'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WDC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SSJ'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'CHI'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'TWU'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'LAX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'VVV'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'MON'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WWW'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'LED'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'XXX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'MIN'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ZAJ'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'CHI'
|
||||
select sign( cast(a2 as char(1024)) ) , sign( cast(a4 as char(1024)) ) from t2 for update;
|
||||
sign( cast(a2 as char(1024)) ) sign( cast(a4 as char(1024)) )
|
||||
0 1
|
||||
0 -1
|
||||
1 -1
|
||||
-1 -1
|
||||
1 1
|
||||
1 1
|
||||
-1 1
|
||||
-1 -1
|
||||
1 -1
|
||||
1 1
|
||||
-1 NULL
|
||||
-1 -1
|
||||
NULL NULL
|
||||
0 -1
|
||||
-1 1
|
||||
1 NULL
|
||||
NULL NULL
|
||||
1 -1
|
||||
6061
test/mysql_test/test_suite/static_engine/r/mysql/expr_str.result
Normal file
6061
test/mysql_test/test_suite/static_engine/r/mysql/expr_str.result
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,96 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select substr('abcdef', 0) from dual;
|
||||
substr('abcdef', 0)
|
||||
|
||||
select substr('abcdef', -1) from dual;
|
||||
substr('abcdef', -1)
|
||||
f
|
||||
select substr('abcdef', 1) from dual;
|
||||
substr('abcdef', 1)
|
||||
abcdef
|
||||
select substr('abcdef', 2) from dual;
|
||||
substr('abcdef', 2)
|
||||
bcdef
|
||||
select substr('abcdef', 10) from dual;
|
||||
substr('abcdef', 10)
|
||||
|
||||
select substr('', 1) from dual;
|
||||
substr('', 1)
|
||||
|
||||
select substr('abcdef', 10) from dual;
|
||||
substr('abcdef', 10)
|
||||
|
||||
select substr('abcdef', 2, 1) from dual;
|
||||
substr('abcdef', 2, 1)
|
||||
b
|
||||
select substr('abcdef', 2, 2) from dual;
|
||||
substr('abcdef', 2, 2)
|
||||
bc
|
||||
select substr('abcdef', 2, 0) from dual;
|
||||
substr('abcdef', 2, 0)
|
||||
|
||||
select substr('abcdef', 2, -1) from dual;
|
||||
substr('abcdef', 2, -1)
|
||||
|
||||
select substr('abcdef', 2, 100) from dual;
|
||||
substr('abcdef', 2, 100)
|
||||
bcdef
|
||||
select substr('', 2, 100) from dual;
|
||||
substr('', 2, 100)
|
||||
|
||||
select substr(NULL, 2, 1) from dual;
|
||||
substr(NULL, 2, 1)
|
||||
NULL
|
||||
select substr('abcdef', NULL, 1) from dual;
|
||||
substr('abcdef', NULL, 1)
|
||||
NULL
|
||||
select substr('abcdef', 2, NULL) from dual;
|
||||
substr('abcdef', 2, NULL)
|
||||
NULL
|
||||
select substr(3.14159, 2, 3) from dual;
|
||||
substr(3.14159, 2, 3)
|
||||
.14
|
||||
explain select substr(3.14159, '2', '3') from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([?]), filter(nil)
|
||||
values({?})
|
||||
|
||||
select substr(3.14159, '2', '2.1') from dual;
|
||||
substr(3.14159, '2', '2.1')
|
||||
.1
|
||||
select substr(3.14159, '2', '2.9') from dual;
|
||||
substr(3.14159, '2', '2.9')
|
||||
.1
|
||||
select substr(3.14159, '2', '2.9') from dual;
|
||||
substr(3.14159, '2', '2.9')
|
||||
.1
|
||||
select substr(3.14159, '2.1', '2.9') from dual;
|
||||
substr(3.14159, '2.1', '2.9')
|
||||
.1
|
||||
select substr(3.14159, '2.9', '2.9') from dual;
|
||||
substr(3.14159, '2.9', '2.9')
|
||||
.1
|
||||
select substr(3.14159, 2.1, '2.9') from dual;
|
||||
substr(3.14159, 2.1, '2.9')
|
||||
.1
|
||||
select substr(3.14159, 2.9, '2.9') from dual;
|
||||
substr(3.14159, 2.9, '2.9')
|
||||
14
|
||||
select substr(3.14159, 2.9, 2.9) from dual;
|
||||
substr(3.14159, 2.9, 2.9)
|
||||
141
|
||||
select substr(3.14159, 2.1, 2.1) from dual;
|
||||
substr(3.14159, 2.1, 2.1)
|
||||
.1
|
||||
connection syscon;
|
||||
@ -0,0 +1,88 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 bigint, c2 bigint unsigned, c3 decimal(40,2), c4 varchar(40));
|
||||
insert into t1 (c1, c2, c3, c4) values (-1, 0, 1, "2.1");
|
||||
insert into t1 (c1, c2, c3, c4) values (-2, 0, 2.1, "2.9");
|
||||
insert into t1 (c1, c2, c3, c4) values (-2, 0, 2.9, "2.9");
|
||||
insert into t1 (c1, c2, c3, c4) values (-10, 0, 10, "10");
|
||||
insert into t1 (c1, c2, c3, c4) values (4294967296, 4294967296, 4294967296, "4294967296");
|
||||
insert into t1 (c1, c2, c3, c4) values (4294967297, 4294967297, 4294967295, "4294967295");
|
||||
insert into t1 (c1, c2, c3, c4) values (-4294967296, 4294967296, -4294967296, "-4294967296");
|
||||
insert into t1 (c1, c2, c3, c4) values (-4294967297, 4294967297, -4294967295, "-4294967295");
|
||||
insert into t1 (c1, c2, c3, c4) values (9223372036854775806, 9223372036854775808, 9223372036854775808, "9223372036854775808");
|
||||
insert into t1 (c1, c2, c3, c4) values (9223372036854775807, 9223372036854775807, 9223372036854775807, "9223372036854775807");
|
||||
insert into t1 (c1, c2, c3, c4) values (9223372036854775806, 9223372036854775809, 9223372036854775809, "9223372036854775809");
|
||||
insert into t1 (c1, c2, c3, c4) values (-9223372036854775807, 9223372036854775807, -9223372036854775807, "-9223372036854775807");
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select substring_index("a,b,c,d", ",", -1);
|
||||
substring_index("a,b,c,d", ",", -1)
|
||||
d
|
||||
select substring_index("a,b,c,d", ",", 0);
|
||||
substring_index("a,b,c,d", ",", 0)
|
||||
|
||||
select substring_index("a,b,c,d", ",", 1);
|
||||
substring_index("a,b,c,d", ",", 1)
|
||||
a
|
||||
select substring_index("a,b,c,d", ",", 2);
|
||||
substring_index("a,b,c,d", ",", 2)
|
||||
a,b
|
||||
select substring_index("", ",", 2);
|
||||
substring_index("", ",", 2)
|
||||
|
||||
select substring_index("a,b,c,d", "", 2);
|
||||
substring_index("a,b,c,d", "", 2)
|
||||
|
||||
select substring_index(NULL, ",", 2);
|
||||
substring_index(NULL, ",", 2)
|
||||
NULL
|
||||
select substring_index("a,b,c,d", NULL, 2);
|
||||
substring_index("a,b,c,d", NULL, 2)
|
||||
NULL
|
||||
select substring_index("a,b,c,d", ",", NULL);
|
||||
substring_index("a,b,c,d", ",", NULL)
|
||||
NULL
|
||||
select substring_index(1.414, 1, 2);
|
||||
substring_index(1.414, 1, 2)
|
||||
1.4
|
||||
select c1, substring_index("a,b,c,d", ",", c1), c2, substring_index("a,b,c,d", ",", c2), c3, substring_index("a,b,c,d", ",", c3), c4, substring_index("a,b,c,d", ",", c4) from t1;
|
||||
c1 substring_index("a,b,c,d", ",", c1) c2 substring_index("a,b,c,d", ",", c2) c3 substring_index("a,b,c,d", ",", c3) c4 substring_index("a,b,c,d", ",", c4)
|
||||
-1 d 0 1.00 a 2.1 a,b
|
||||
-2 c,d 0 2.10 a,b 2.9 a,b
|
||||
-2 c,d 0 2.90 a,b,c 2.9 a,b
|
||||
-10 a,b,c,d 0 10.00 a,b,c,d 10 a,b,c,d
|
||||
4294967296 4294967296 4294967296.00 4294967296
|
||||
4294967297 a 4294967297 a 4294967295.00 d 4294967295 d
|
||||
-4294967296 4294967296 -4294967296.00 -4294967296
|
||||
-4294967297 d 4294967297 a -4294967295.00 a -4294967295 a
|
||||
9223372036854775806 c,d 9223372036854775808 9223372036854775808.00 d 9223372036854775808 d
|
||||
9223372036854775807 d 9223372036854775807 d 9223372036854775807.00 d 9223372036854775807 d
|
||||
9223372036854775806 c,d 9223372036854775809 a 9223372036854775809.00 d 9223372036854775809 d
|
||||
-9223372036854775807 a 9223372036854775807 d -9223372036854775807.00 a -9223372036854775807 a
|
||||
drop table if exists t2, t3;
|
||||
create table t2(c1 varchar(20));
|
||||
create table t3(c1 varchar(20));
|
||||
insert into t2 values(null), (''), ('1');
|
||||
insert into t3 values(''), (null), ('1');
|
||||
//the result of next 2 sqls should be same
|
||||
select c1, substring_index(c1, 'vpprm', -47) from t2 order by c1;
|
||||
c1 substring_index(c1, 'vpprm', -47)
|
||||
NULL NULL
|
||||
|
||||
1 1
|
||||
select c1, substring_index(c1, 'vpprm', -47) from t3 order by c1;
|
||||
c1 substring_index(c1, 'vpprm', -47)
|
||||
NULL NULL
|
||||
|
||||
1 1
|
||||
drop table t1, t2,t3;
|
||||
drop table if exists t1;
|
||||
create table t1(c1 char(10));
|
||||
insert into t1 values(null), ('');
|
||||
select substring_index(c1, 'a', 1) from t1;
|
||||
substring_index(c1, 'a', 1)
|
||||
NULL
|
||||
|
||||
connection syscon;
|
||||
@ -0,0 +1,29 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connect rootcon, $OBMYSQL_MS0,root@$TENANT,,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select sys_privilege_check('table_acc', effective_tenant_id(), 'oceanbase', '__all_user');
|
||||
sys_privilege_check('table_acc', effective_tenant_id(), 'oceanbase', '__all_user')
|
||||
0
|
||||
select sys_privilege_check('db_acc', effective_tenant_id(), 'oceanbase_', '__all_user_');
|
||||
sys_privilege_check('db_acc', effective_tenant_id(), 'oceanbase_', '__all_user_')
|
||||
0
|
||||
drop database if exists espcndb;
|
||||
create database espcndb;
|
||||
connection rootcon;
|
||||
create user espcnouser;
|
||||
grant all on test.* to espcnouser;
|
||||
connect con1, $OBMYSQL_MS0,espcnouser@$TENANT,,test,$OBMYSQL_PORT;
|
||||
connection con1;
|
||||
select sys_privilege_check('db_acc', effective_tenant_id(), 'test', 't');
|
||||
sys_privilege_check('db_acc', effective_tenant_id(), 'test', 't')
|
||||
0
|
||||
select sys_privilege_check('db_acc', effective_tenant_id(), 'espcndb', 't');
|
||||
sys_privilege_check('db_acc', effective_tenant_id(), 'espcndb', 't')
|
||||
-1
|
||||
connection default;
|
||||
drop user espcnouser;
|
||||
drop database espcnouser;
|
||||
ERROR HY000: Can't drop database 'espcnouser'; database doesn't exist
|
||||
connection syscon;
|
||||
@ -0,0 +1,181 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1(c1 datetime, c2 timestamp, c3 date, c4 time);
|
||||
insert into t1 values('1234-12-12 01:23:45', '2020-01-01 01:23:45', '1234-12-12', '01:23:45');
|
||||
insert into t1 values('2000-2-29 01:23:45.678', '2000-2-29 01:23:45.678', '2000-2-29', '01:23:45.678');
|
||||
insert into t1 values('2001-12-31 12:00:00', '2001-12-31 12:00:00', '2001-12-31', '12:00:00');
|
||||
insert into t1 values(null, null, null, null);
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
select a.c1, b.c1, timediff(a.c1, b.c1) from t1 a, t1 b;
|
||||
c1 c1 timediff(a.c1, b.c1)
|
||||
1234-12-12 01:23:45 1234-12-12 01:23:45 00:00:00
|
||||
1234-12-12 01:23:45 2000-02-29 01:23:46 -838:59:59
|
||||
1234-12-12 01:23:45 2001-12-31 12:00:00 -838:59:59
|
||||
1234-12-12 01:23:45 NULL NULL
|
||||
2000-02-29 01:23:46 1234-12-12 01:23:45 838:59:59
|
||||
2000-02-29 01:23:46 2000-02-29 01:23:46 00:00:00
|
||||
2000-02-29 01:23:46 2001-12-31 12:00:00 -838:59:59
|
||||
2000-02-29 01:23:46 NULL NULL
|
||||
2001-12-31 12:00:00 1234-12-12 01:23:45 838:59:59
|
||||
2001-12-31 12:00:00 2000-02-29 01:23:46 838:59:59
|
||||
2001-12-31 12:00:00 2001-12-31 12:00:00 00:00:00
|
||||
2001-12-31 12:00:00 NULL NULL
|
||||
NULL 1234-12-12 01:23:45 NULL
|
||||
NULL 2000-02-29 01:23:46 NULL
|
||||
NULL 2001-12-31 12:00:00 NULL
|
||||
NULL NULL NULL
|
||||
select a.c2, b.c2, timediff(a.c2, b.c2) from t1 a, t1 b;
|
||||
c2 c2 timediff(a.c2, b.c2)
|
||||
2020-01-01 01:23:45 2020-01-01 01:23:45 00:00:00
|
||||
2020-01-01 01:23:45 2000-02-29 01:23:46 838:59:59
|
||||
2020-01-01 01:23:45 2001-12-31 12:00:00 838:59:59
|
||||
2020-01-01 01:23:45 NULL NULL
|
||||
2000-02-29 01:23:46 2020-01-01 01:23:45 -838:59:59
|
||||
2000-02-29 01:23:46 2000-02-29 01:23:46 00:00:00
|
||||
2000-02-29 01:23:46 2001-12-31 12:00:00 -838:59:59
|
||||
2000-02-29 01:23:46 NULL NULL
|
||||
2001-12-31 12:00:00 2020-01-01 01:23:45 -838:59:59
|
||||
2001-12-31 12:00:00 2000-02-29 01:23:46 838:59:59
|
||||
2001-12-31 12:00:00 2001-12-31 12:00:00 00:00:00
|
||||
2001-12-31 12:00:00 NULL NULL
|
||||
NULL 2020-01-01 01:23:45 NULL
|
||||
NULL 2000-02-29 01:23:46 NULL
|
||||
NULL 2001-12-31 12:00:00 NULL
|
||||
NULL NULL NULL
|
||||
select a.c3, b.c3, timediff(a.c3, b.c3) from t1 a, t1 b;
|
||||
c3 c3 timediff(a.c3, b.c3)
|
||||
1234-12-12 1234-12-12 00:00:00
|
||||
1234-12-12 2000-02-29 -838:59:59
|
||||
1234-12-12 2001-12-31 -838:59:59
|
||||
1234-12-12 NULL NULL
|
||||
2000-02-29 1234-12-12 838:59:59
|
||||
2000-02-29 2000-02-29 00:00:00
|
||||
2000-02-29 2001-12-31 -838:59:59
|
||||
2000-02-29 NULL NULL
|
||||
2001-12-31 1234-12-12 838:59:59
|
||||
2001-12-31 2000-02-29 838:59:59
|
||||
2001-12-31 2001-12-31 00:00:00
|
||||
2001-12-31 NULL NULL
|
||||
NULL 1234-12-12 NULL
|
||||
NULL 2000-02-29 NULL
|
||||
NULL 2001-12-31 NULL
|
||||
NULL NULL NULL
|
||||
select a.c4, b.c4, timediff(a.c4, b.c4) from t1 a, t1 b;
|
||||
c4 c4 timediff(a.c4, b.c4)
|
||||
01:23:45 01:23:45 00:00:00
|
||||
01:23:45 01:23:46 -00:00:01
|
||||
01:23:45 12:00:00 -10:36:15
|
||||
01:23:45 NULL NULL
|
||||
01:23:46 01:23:45 00:00:01
|
||||
01:23:46 01:23:46 00:00:00
|
||||
01:23:46 12:00:00 -10:36:14
|
||||
01:23:46 NULL NULL
|
||||
12:00:00 01:23:45 10:36:15
|
||||
12:00:00 01:23:46 10:36:14
|
||||
12:00:00 12:00:00 00:00:00
|
||||
12:00:00 NULL NULL
|
||||
NULL 01:23:45 NULL
|
||||
NULL 01:23:46 NULL
|
||||
NULL 12:00:00 NULL
|
||||
NULL NULL NULL
|
||||
select timediff(c1, c1) from t1;
|
||||
timediff(c1, c1)
|
||||
00:00:00
|
||||
00:00:00
|
||||
00:00:00
|
||||
NULL
|
||||
select timediff(c1, c2) from t1;
|
||||
timediff(c1, c2)
|
||||
-838:59:59
|
||||
00:00:00
|
||||
00:00:00
|
||||
NULL
|
||||
select timediff(c1, c3) from t1;
|
||||
timediff(c1, c3)
|
||||
01:23:45
|
||||
01:23:46
|
||||
12:00:00
|
||||
NULL
|
||||
select timediff(c1, c4) from t1;
|
||||
timediff(c1, c4)
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
select timediff(c2, c1) from t1;
|
||||
timediff(c2, c1)
|
||||
838:59:59
|
||||
00:00:00
|
||||
00:00:00
|
||||
NULL
|
||||
select timediff(c2, c2) from t1;
|
||||
timediff(c2, c2)
|
||||
00:00:00
|
||||
00:00:00
|
||||
00:00:00
|
||||
NULL
|
||||
select timediff(c2, c3) from t1;
|
||||
timediff(c2, c3)
|
||||
838:59:59
|
||||
01:23:46
|
||||
12:00:00
|
||||
NULL
|
||||
select timediff(c2, c4) from t1;
|
||||
timediff(c2, c4)
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
select timediff(c3, c1) from t1;
|
||||
timediff(c3, c1)
|
||||
-01:23:45
|
||||
-01:23:46
|
||||
-12:00:00
|
||||
NULL
|
||||
select timediff(c3, c2) from t1;
|
||||
timediff(c3, c2)
|
||||
-838:59:59
|
||||
-01:23:46
|
||||
-12:00:00
|
||||
NULL
|
||||
select timediff(c3, c3) from t1;
|
||||
timediff(c3, c3)
|
||||
00:00:00
|
||||
00:00:00
|
||||
00:00:00
|
||||
NULL
|
||||
select timediff(c3, c4) from t1;
|
||||
timediff(c3, c4)
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
select timediff(c4, c1) from t1;
|
||||
timediff(c4, c1)
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
select timediff(c4, c2) from t1;
|
||||
timediff(c4, c2)
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
select timediff(c4, c3) from t1;
|
||||
timediff(c4, c3)
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
select timediff(c4, c4) from t1;
|
||||
timediff(c4, c4)
|
||||
00:00:00
|
||||
00:00:00
|
||||
00:00:00
|
||||
NULL
|
||||
connection conn_admin;
|
||||
File diff suppressed because it is too large
Load Diff
2128
test/mysql_test/test_suite/static_engine/r/mysql/expr_todays.result
Normal file
2128
test/mysql_test/test_suite/static_engine/r/mysql/expr_todays.result
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,75 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select trim(' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(leading from ' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(trailing from ' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(both from ' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(both '' from ' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(both ' ' from ' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(both 'abc' from 'abcabdefabcabc') x from dual;
|
||||
x
|
||||
abdef
|
||||
select trim(both ' ' from ' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(both NULL from ' abc ') x from dual;
|
||||
x
|
||||
NULL
|
||||
select trim(both ' ' from NULL) x from dual;
|
||||
x
|
||||
NULL
|
||||
select trim(both 1 from 112311) x from dual;
|
||||
x
|
||||
23
|
||||
select ltrim(' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select ltrim(' ') x from dual;
|
||||
x
|
||||
|
||||
select ltrim(NULL) x from dual;
|
||||
x
|
||||
NULL
|
||||
select rtrim(' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select rtrim(' ') x from dual;
|
||||
x
|
||||
|
||||
select rtrim(NULL) x from dual;
|
||||
x
|
||||
NULL
|
||||
drop table if exists t1;
|
||||
drop view if exists v1;
|
||||
create view v1 as select nullif(trim(repeat('abc', 1+1)), 'a');
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
nullif(trim(repeat('abc', 1+1)), 'a') longtext NO
|
||||
select * from v1;
|
||||
nullif(trim(repeat('abc', 1+1)), 'a')
|
||||
abcabc
|
||||
create table t1(c1 longtext, c2 varchar(100));
|
||||
insert into t1 values('abababa', 'a');
|
||||
// c1 and c2 will cast to longtext
|
||||
select trim(leading c2 from c1) from t1;
|
||||
trim(leading c2 from c1)
|
||||
bababa
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
connection syscon;
|
||||
12663
test/mysql_test/test_suite/static_engine/r/mysql/expr_trunc.result
Normal file
12663
test/mysql_test/test_suite/static_engine/r/mysql/expr_trunc.result
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,16 @@
|
||||
connect sys, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 varchar(2000));
|
||||
insert into t1 values(hex("ABC")), (hex("123"));
|
||||
connection sys;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select unhex(c1) from t1;
|
||||
unhex(c1)
|
||||
ABC
|
||||
123
|
||||
select unhex("4142") from dual;
|
||||
unhex("4142")
|
||||
AB
|
||||
connection sys;
|
||||
@ -0,0 +1,83 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
set ob_enable_plan_cache = 0;
|
||||
select unix_timestamp(NULL);
|
||||
unix_timestamp(NULL)
|
||||
NULL
|
||||
select unix_timestamp('');
|
||||
unix_timestamp('')
|
||||
0.000000
|
||||
select unix_timestamp('2010-01-01 10:50:50.123');
|
||||
unix_timestamp('2010-01-01 10:50:50.123')
|
||||
1262314250.123
|
||||
select unix_timestamp(123);
|
||||
unix_timestamp(123)
|
||||
948556800
|
||||
drop table if exists t1;
|
||||
create table t1 (col_datetime_4_not_null datetime(4) not null);
|
||||
insert into t1 values
|
||||
('0000-00-00 00:00:00.0000'),('2006-05-12 07:06:44.0441'),('2007-11-08 00:00:00.0000'), ('2007-07-23 00:00:00.0000'),('2006-01-10 22:19:14.0158'),('2006-09-13 18:54:05.0013'), ('2002-03-26 00:00:00.0000'),('2002-10-22 10:53:06.0151'),('0000-00-00 00:00:00.0000'),('2001-06-04 00:00:00.0000'),('0000-00-00 00:00:00.0000'),('2000-12-11 10:47:58.0505'), ('2009-04-21 20:01:40.0570'),('2007-03-12 10:48:41.0031'),('0000-00-00 00:00:00.0000'), ('2009-06-22 00:00:00.0000'),('2008-01-21 15:28:44.0592'),('2003-10-05 00:43:55.0577'), ('2002-11-04 00:46:30.0630'),('2006-01-19 11:38:03.0378'),('0000-00-00 00:00:00.0000'), ('2001-02-04 00:00:00.0000'),('2004-10-22 21:59:04.0394'),('2006-03-20 18:54:13.0139'), ('2004-06-09 03:17:31.0403'),('0000-00-00 00:00:00.0000'),('2003-06-01 17:59:12.0365'), ('0000-00-00 00:00:00.0000'),('2009-06-15 08:58:58.0329'),('0000-00-00 00:00:00.0000'), ('2004-03-26 00:00:00.0000'),('2009-04-27 00:00:00.0000'),('2000-09-07 00:00:00.0000'), ('2006-11-04 00:51:03.0501'),('2005-02-20 00:30:47.0647'),('0000-00-00 00:00:00.0000'), ('2004-12-07 00:00:00.0000'),('0000-00-00 00:00:00.0000'),('0000-00-00 00:00:00.0000'), ('2002-08-17 00:27:20.0536'),('2006-10-12 12:12:28.0337'),('0000-00-00 00:00:00.0000'), ('0000-00-00 00:00:00.0000'),('2009-09-09 14:16:05.0354'),('2000-02-25 00:00:00.0000'), ('2003-12-16 05:38:37.0626'),('2000-10-05 03:46:43.0067'),('0000-00-00 00:00:00.0000'), ('2000-10-08 06:45:51.0547'),('0000-00-00 00:00:00.0000'),('2000-04-06 01:46:21.0620'), ('2001-08-10 23:15:40.0304'),('2001-06-24 10:14:00.0497'),('0000-00-00 00:00:00.0000'), ('0000-00-00 00:00:00.0000'),('2004-10-22 00:00:00.0000'),('0000-00-00 00:00:00.0000'), ('0000-00-00 00:00:00.0000'),('2005-08-23 06:34:23.0058'),('2005-03-28 18:34:18.0138'),('2004-05-18 00:00:00.0000');
|
||||
select col_datetime_4_not_null, unix_timestamp(col_datetime_4_not_null) from t1 order by 1;
|
||||
col_datetime_4_not_null unix_timestamp(col_datetime_4_not_null)
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
2000-02-25 00:00:00.0000 951408000.0000
|
||||
2000-04-06 01:46:21.0620 954956781.0620
|
||||
2000-09-07 00:00:00.0000 968256000.0000
|
||||
2000-10-05 03:46:43.0067 970688803.0067
|
||||
2000-10-08 06:45:51.0547 970958751.0547
|
||||
2000-12-11 10:47:58.0505 976502878.0505
|
||||
2001-02-04 00:00:00.0000 981216000.0000
|
||||
2001-06-04 00:00:00.0000 991584000.0000
|
||||
2001-06-24 10:14:00.0497 993348840.0497
|
||||
2001-08-10 23:15:40.0304 997456540.0304
|
||||
2002-03-26 00:00:00.0000 1017072000.0000
|
||||
2002-08-17 00:27:20.0536 1029515240.0536
|
||||
2002-10-22 10:53:06.0151 1035255186.0151
|
||||
2002-11-04 00:46:30.0630 1036341990.0630
|
||||
2003-06-01 17:59:12.0365 1054461552.0365
|
||||
2003-10-05 00:43:55.0577 1065285835.0577
|
||||
2003-12-16 05:38:37.0626 1071524317.0626
|
||||
2004-03-26 00:00:00.0000 1080230400.0000
|
||||
2004-05-18 00:00:00.0000 1084809600.0000
|
||||
2004-06-09 03:17:31.0403 1086722251.0403
|
||||
2004-10-22 00:00:00.0000 1098374400.0000
|
||||
2004-10-22 21:59:04.0394 1098453544.0394
|
||||
2004-12-07 00:00:00.0000 1102348800.0000
|
||||
2005-02-20 00:30:47.0647 1108830647.0647
|
||||
2005-03-28 18:34:18.0138 1112006058.0138
|
||||
2005-08-23 06:34:23.0058 1124750063.0058
|
||||
2006-01-10 22:19:14.0158 1136902754.0158
|
||||
2006-01-19 11:38:03.0378 1137641883.0378
|
||||
2006-03-20 18:54:13.0139 1142852053.0139
|
||||
2006-05-12 07:06:44.0441 1147388804.0441
|
||||
2006-09-13 18:54:05.0013 1158144845.0013
|
||||
2006-10-12 12:12:28.0337 1160626348.0337
|
||||
2006-11-04 00:51:03.0501 1162572663.0501
|
||||
2007-03-12 10:48:41.0031 1173667721.0031
|
||||
2007-07-23 00:00:00.0000 1185120000.0000
|
||||
2007-11-08 00:00:00.0000 1194451200.0000
|
||||
2008-01-21 15:28:44.0592 1200900524.0592
|
||||
2009-04-21 20:01:40.0570 1240315300.0570
|
||||
2009-04-27 00:00:00.0000 1240761600.0000
|
||||
2009-06-15 08:58:58.0329 1245027538.0329
|
||||
2009-06-22 00:00:00.0000 1245600000.0000
|
||||
2009-09-09 14:16:05.0354 1252476965.0354
|
||||
13535
test/mysql_test/test_suite/static_engine/r/mysql/expr_xor.result
Normal file
13535
test/mysql_test/test_suite/static_engine/r/mysql/expr_xor.result
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,103 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t111_var;
|
||||
create table t1(c1 int,c2 int,c3 int);
|
||||
create table t2(c1 int,c2 int,c3 int);
|
||||
insert into t1 values(1,2,3);
|
||||
insert into t1 values(1,2,3);
|
||||
insert into t1 values(0,2,3);
|
||||
insert into t1 values(2,2,3);
|
||||
insert into t1 values(3,2,3);
|
||||
insert into t2 values(2,2,3);
|
||||
insert into t2 values(2,0,3);
|
||||
insert into t2 values(0,2,3);
|
||||
insert into t2 values(1,2,3);
|
||||
insert into t2 values(null,2,3);
|
||||
insert into t2 values(1,2,3);
|
||||
insert into t2 values(0,2,1);
|
||||
insert into t2 values(2,2,3);
|
||||
commit;
|
||||
create table t111_var(c0 bigint,c1 varchar(4000), c2 varchar(4000), c3 varchar(4000), c4 varchar(4000), c5 varchar(4000),c6 varchar(4000), c7 longtext);
|
||||
insert into t111_var values(1,repeat('ab',2000),repeat('ab',2000),repeat('ab',2000),repeat('ab',2000),repeat('ab',2000),repeat('ab',2000),repeat('abcdefghij',4000));
|
||||
insert into t111_var select c0+1,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+10,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+100,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+1000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+10000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+100000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+1000000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+10000000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+100000000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var values(null,null,null,null,null,null,null,null);
|
||||
insert into t111_var select * from t111_var;
|
||||
commit;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select /*+ USE_HASH_AGGREGATION */distinct c1,c2 from t2;
|
||||
c1 c2
|
||||
2 2
|
||||
2 0
|
||||
0 2
|
||||
1 2
|
||||
NULL 2
|
||||
select /*+ USE_HASH_AGGREGATION */distinct c2,c1 from t2;
|
||||
c2 c1
|
||||
2 2
|
||||
0 2
|
||||
2 0
|
||||
2 1
|
||||
2 NULL
|
||||
select /*+ USE_HASH_AGGREGATION */distinct c2,c1,c1+c2 from t2;
|
||||
c2 c1 c1+c2
|
||||
2 2 4
|
||||
0 2 2
|
||||
2 0 2
|
||||
2 1 3
|
||||
2 NULL NULL
|
||||
select /*+ USE_HASH_AGGREGATION */distinct c1+c2,abs(c1) from t2;
|
||||
c1+c2 abs(c1)
|
||||
4 2
|
||||
2 2
|
||||
2 0
|
||||
3 1
|
||||
NULL NULL
|
||||
select /*+ USE_HASH_AGGREGATION */distinct c1+c2 from t2;
|
||||
c1+c2
|
||||
4
|
||||
2
|
||||
3
|
||||
NULL
|
||||
select /*+ USE_HASH_AGGREGATION */distinct c2,c1,c3 from t2;
|
||||
c2 c1 c3
|
||||
2 2 3
|
||||
0 2 3
|
||||
2 0 3
|
||||
2 1 3
|
||||
2 NULL 3
|
||||
2 0 1
|
||||
select /*+ USE_HASH_AGGREGATION */distinct 1,2,3,5,'ab' from t2;
|
||||
1 2 3 5 ab
|
||||
1 2 3 5 ab
|
||||
select /*+ USE_HASH_AGGREGATION */distinct 1,c2,2,3,c1,5,'ab' from t2;
|
||||
1 c2 2 3 c1 5 ab
|
||||
1 2 2 3 2 5 ab
|
||||
1 0 2 3 2 5 ab
|
||||
1 2 2 3 0 5 ab
|
||||
1 2 2 3 1 5 ab
|
||||
1 2 2 3 NULL 5 ab
|
||||
select /*+ USE_HASH_AGGREGATION */distinct 1,c2,2,3,c1,5,'ab' from t2 where c2=0;
|
||||
1 c2 2 3 c1 5 ab
|
||||
1 0 2 3 2 5 ab
|
||||
set ob_query_timeout=30000000;
|
||||
select /*+ use_merge(a b) */SQL_CALC_FOUND_ROWS sum(c0),sum(length(c1)),count(c2),count(c3),count(c4),count(c5),count(c6),count(c7)
|
||||
from (select /*+ USE_HASH_AGGREGATION */ distinct * from t111_var) order by c1 limit 1;
|
||||
sum(c0) sum(length(c1)) count(c2) count(c3) count(c4) count(c5) count(c6) count(c7)
|
||||
28444444928 2048000 512 512 512 512 512 512
|
||||
connection syscon;
|
||||
connection default;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t111_var;
|
||||
128
test/mysql_test/test_suite/static_engine/r/mysql/hash_set.result
Normal file
128
test/mysql_test/test_suite/static_engine/r/mysql/hash_set.result
Normal file
@ -0,0 +1,128 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
drop tenant dump_tenant force;
|
||||
drop resource pool new_pool1;
|
||||
drop resource unit new_box1;
|
||||
connect conn1,$OBMYSQL_MS0,root@dump_tenant,,test,$OBMYSQL_PORT;
|
||||
set global parallel_max_servers=10;
|
||||
set global parallel_servers_target=10;
|
||||
alter system set _sort_area_size='2M';
|
||||
alter system set _hash_area_size='4M';
|
||||
drop table t11_set;
|
||||
drop table t22_set;
|
||||
drop table t111_var;
|
||||
drop table t333_var;
|
||||
create table t11_set(c1 int,c2 int);
|
||||
create table t22_set(c1 int,c2 int);
|
||||
insert into t11_set values(null,null);
|
||||
insert into t11_set values(1,1);
|
||||
insert into t11_set values(5,5);
|
||||
insert into t11_set values(1,1);
|
||||
insert into t11_set values(5,5);
|
||||
insert into t11_set values(12,12);
|
||||
insert into t11_set values(12,12);
|
||||
insert into t11_set values(22,22);
|
||||
insert into t11_set values(26,26);
|
||||
insert into t11_set values(22,22);
|
||||
insert into t11_set values(26,26);
|
||||
insert into t22_set select * from t11_set;
|
||||
create table t111_var(c0 bigint primary key,c1 varchar(4000), c2 varchar(4000), c3 varchar(4000), c4 varchar(4000), c5 varchar(4000),c6 varchar(4000), c7 longtext);
|
||||
insert into t111_var values(1,repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('a',4000));
|
||||
insert into t111_var select c0+1,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+10,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+100,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+1000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+10000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+100000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+1000000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+10000000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+100000000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
commit;
|
||||
create table t333_var(c0 bigint ,c1 varchar(4000), c2 varchar(4000), c3 varchar(4000), c4 varchar(4000), c5 varchar(4000),c6 varchar(4000), c7 longtext);
|
||||
insert into t333_var values(1,repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('a',4000));
|
||||
insert into t333_var select c0+1,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+10,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+100,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+1000,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+10000,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+100000,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+1000000,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+10000000,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+100000000,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var values(null,null,null,null,null,null,null,null);
|
||||
commit;
|
||||
select c1,c2 from t11_set union select c1,c2 from t22_set where c1 > 5 and c1 != 12;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
22 22
|
||||
26 26
|
||||
select c1,c2 from t11_set intersect select c1,c2 from t22_set where c1 > 5 and c1 != 12;
|
||||
c1 c2
|
||||
22 22
|
||||
26 26
|
||||
select c1,c2 from t11_set minus select c1,c2 from t22_set where c1 > 5 and c1 != 12;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
select c1,c2 from t11_set where c1 > 5 and c1 != 12 union select c1,c2 from t22_set;
|
||||
c1 c2
|
||||
22 22
|
||||
26 26
|
||||
NULL NULL
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
select c1,c2 from t11_set where c1 > 5 and c1 != 12 intersect select c1,c2 from t22_set;
|
||||
c1 c2
|
||||
22 22
|
||||
26 26
|
||||
select c1,c2 from t11_set where c1 > 5 and c1 != 12 minus select c1,c2 from t22_set;
|
||||
c1 c2
|
||||
select c1,c2 from t11_set union select c1,c2 from t22_set where c1 <22;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
22 22
|
||||
26 26
|
||||
select c1,c2 from t11_set intersect select c1,c2 from t22_set where c1 <22;
|
||||
c1 c2
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
select c1,c2 from t11_set minus select c1,c2 from t22_set where c1 <22;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
22 22
|
||||
26 26
|
||||
set ob_query_timeout=30000000;
|
||||
select /*+ use_merge(a b) */SQL_CALC_FOUND_ROWS sum(c0),sum(length(c1)),count(c2),count(c3),count(c4),count(c5),count(c6),count(c7)
|
||||
from (select * from t111_var a union select * from t333_var b) order by c1 limit 1;
|
||||
sum(c0) sum(length(c1)) count(c2) count(c3) count(c4) count(c5) count(c6) count(c7)
|
||||
28444444928 1024000 512 512 512 512 512 512
|
||||
select /*+ use_merge(a b) */SQL_CALC_FOUND_ROWS sum(c0),sum(length(c1)),count(c2),count(c3),count(c4),count(c5),count(c6),count(c7)
|
||||
from (select * from t111_var a intersect select * from t333_var b) order by c1 limit 1;
|
||||
sum(c0) sum(length(c1)) count(c2) count(c3) count(c4) count(c5) count(c6) count(c7)
|
||||
28444444928 1024000 512 512 512 512 512 512
|
||||
select /*+ use_merge(a b) */SQL_CALC_FOUND_ROWS sum(c0),sum(length(c1)),count(c2),count(c3),count(c4),count(c5),count(c6),count(c7)
|
||||
from (select * from t111_var a minus select * from t333_var b) order by c1 limit 1;
|
||||
sum(c0) sum(length(c1)) count(c2) count(c3) count(c4) count(c5) count(c6) count(c7)
|
||||
NULL NULL 0 0 0 0 0 0
|
||||
select operation_type,
|
||||
case when sum(optimal_executions)>0 then 1 else 0 end pass1,
|
||||
case when sum(onepass_executions)>0 then 1 else 0 end pass2,
|
||||
case when sum(multipasses_executions)>0 then 1 else 0 end pass3
|
||||
from oceanbase.gv$sql_workarea where con_id =xxx group by operation_type order by 1,2,3,4;
|
||||
operation_type pass1 pass2 pass3
|
||||
PHY_HASH_EXCEPT 0 1 0
|
||||
PHY_HASH_INTERSECT 0 1 0
|
||||
PHY_HASH_UNION 0 1 0
|
||||
connection syscon;
|
||||
drop tenant dump_tenant force;
|
||||
drop resource pool new_pool1;
|
||||
drop resource unit new_box1;
|
||||
@ -0,0 +1,69 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
create table t1(c1 int,c2 int,c3 int);
|
||||
create table t2(c1 int,c2 int,c3 int);
|
||||
insert into t1 values(1,2,3);
|
||||
insert into t1 values(1,2,3);
|
||||
insert into t1 values(0,2,3);
|
||||
insert into t1 values(2,2,3);
|
||||
insert into t1 values(3,2,3);
|
||||
insert into t2 values(2,2,3);
|
||||
insert into t2 values(2,2,3);
|
||||
insert into t2 values(0,2,3);
|
||||
insert into t2 values(1,2,3);
|
||||
insert into t2 values(null,2,3);
|
||||
commit;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
explain select * from t1,t2;
|
||||
Query Plan
|
||||
===================================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
---------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN CARTESIAN| |25 |95 |
|
||||
|1 | TABLE SCAN |t1 |5 |37 |
|
||||
|2 | MATERIAL | |5 |40 |
|
||||
|3 | TABLE SCAN |t2 |5 |37 |
|
||||
===================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t2.c1], [t2.c2], [t2.c3]), filter(nil),
|
||||
conds(nil), nl_params_(nil)
|
||||
1 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil),
|
||||
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
|
||||
2 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil)
|
||||
3 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil),
|
||||
access([t2.c1], [t2.c2], [t2.c3]), partitions(p0)
|
||||
|
||||
select * from t1,t2;
|
||||
c1 c2 c3 c1 c2 c3
|
||||
1 2 3 2 2 3
|
||||
1 2 3 2 2 3
|
||||
1 2 3 0 2 3
|
||||
1 2 3 1 2 3
|
||||
1 2 3 NULL 2 3
|
||||
1 2 3 2 2 3
|
||||
1 2 3 2 2 3
|
||||
1 2 3 0 2 3
|
||||
1 2 3 1 2 3
|
||||
1 2 3 NULL 2 3
|
||||
0 2 3 2 2 3
|
||||
0 2 3 2 2 3
|
||||
0 2 3 0 2 3
|
||||
0 2 3 1 2 3
|
||||
0 2 3 NULL 2 3
|
||||
2 2 3 2 2 3
|
||||
2 2 3 2 2 3
|
||||
2 2 3 0 2 3
|
||||
2 2 3 1 2 3
|
||||
2 2 3 NULL 2 3
|
||||
3 2 3 2 2 3
|
||||
3 2 3 2 2 3
|
||||
3 2 3 0 2 3
|
||||
3 2 3 1 2 3
|
||||
3 2 3 NULL 2 3
|
||||
connection syscon;
|
||||
@ -0,0 +1,77 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table t11_set;
|
||||
drop table t22_set;
|
||||
create table t11_set(c1 int,c2 int);
|
||||
create table t22_set(c1 int,c2 int);
|
||||
insert into t11_set values(null,null);
|
||||
insert into t11_set values(1,1);
|
||||
insert into t11_set values(5,5);
|
||||
insert into t11_set values(1,1);
|
||||
insert into t11_set values(5,5);
|
||||
insert into t11_set values(12,12);
|
||||
insert into t11_set values(12,12);
|
||||
insert into t11_set values(22,22);
|
||||
insert into t11_set values(26,26);
|
||||
insert into t11_set values(22,22);
|
||||
insert into t11_set values(26,26);
|
||||
insert into t22_set select * from t11_set;
|
||||
create index idx_t11_set on t11_set(c1,c2);
|
||||
create index idx_t22_set on t22_set(c1,c2);
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select c1,c2 from t11_set union select c1,c2 from t22_set where c1 > 5 and c1 != 12;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
22 22
|
||||
26 26
|
||||
select c1,c2 from t11_set intersect select c1,c2 from t22_set where c1 > 5 and c1 != 12;
|
||||
c1 c2
|
||||
22 22
|
||||
26 26
|
||||
select c1,c2 from t11_set minus select c1,c2 from t22_set where c1 > 5 and c1 != 12;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
select c1,c2 from t11_set where c1 > 5 and c1 != 12 union select c1,c2 from t22_set;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
22 22
|
||||
26 26
|
||||
select c1,c2 from t11_set where c1 > 5 and c1 != 12 intersect select c1,c2 from t22_set;
|
||||
c1 c2
|
||||
22 22
|
||||
26 26
|
||||
select c1,c2 from t11_set where c1 > 5 and c1 != 12 minus select c1,c2 from t22_set;
|
||||
c1 c2
|
||||
select c1,c2 from t11_set union select c1,c2 from t22_set where c1 <22;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
22 22
|
||||
26 26
|
||||
select c1,c2 from t11_set intersect select c1,c2 from t22_set where c1 <22;
|
||||
c1 c2
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
select c1,c2 from t11_set minus select c1,c2 from t22_set where c1 <22;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
22 22
|
||||
26 26
|
||||
connection syscon;
|
||||
connection default;
|
||||
drop table t11_set;
|
||||
drop table t22_set;
|
||||
@ -0,0 +1,35 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
connection default;
|
||||
|
||||
drop table if exists t;
|
||||
create table t(c1 int, c2 int, primary key(c1, c2));
|
||||
insert into t values(1,1);
|
||||
insert into t values(2,2);
|
||||
insert into t values(3,3);
|
||||
insert into t values(4,4);
|
||||
insert into t values(5,5);
|
||||
insert into t values(6,6);
|
||||
alter table t partition by range(c1) (partition p0 values less than (4), partition p1 values less than MAXVALUE);
|
||||
select c2 from t partition(p1);
|
||||
c2
|
||||
4
|
||||
5
|
||||
6
|
||||
|
||||
explain select c2 from t partition(p1);
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |TABLE SCAN|t |6 |37 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t.c2]), filter([calc_partition_id(t.c1) = ?]),
|
||||
access([t.c2], [t.c1]), partitions(p2)
|
||||
|
||||
drop table t;
|
||||
connection conn_admin;
|
||||
128
test/mysql_test/test_suite/static_engine/r/mysql/px_basic.result
Normal file
128
test/mysql_test/test_suite/static_engine/r/mysql/px_basic.result
Normal file
@ -0,0 +1,128 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
||||
create table t3(c1 int primary key,c2 int) partition by hash(c1) partitions 5;
|
||||
create table t4(c1 int primary key,c2 int) partition by hash(c1) partitions 6;
|
||||
insert into t3 values(0,0);
|
||||
insert into t3 values(1,0);
|
||||
insert into t3 values(2,1);
|
||||
insert into t3 values(3,2);
|
||||
insert into t3 values(4,3);
|
||||
insert into t3 values(5,4);
|
||||
insert into t3 values(6,5);
|
||||
insert into t4 values(1,0);
|
||||
insert into t4 values(2,1);
|
||||
insert into t4 values(3,2);
|
||||
insert into t4 values(4,3);
|
||||
insert into t4 values(5,4);
|
||||
insert into t4 values(6,5);
|
||||
insert into t4 values(7,5);
|
||||
commit;
|
||||
create table t5(c1 int primary key,c2 int);
|
||||
insert into t5 values(1,1);
|
||||
insert into t5 values(2,2);
|
||||
insert into t5 values(3,3);
|
||||
insert into t5 values(4,4);
|
||||
insert into t5 values(5,5);
|
||||
insert into t5 values(6,6);
|
||||
commit;
|
||||
create table t1(c1 int,c2 int) partition by hash(c1) partitions 5;
|
||||
create table t2(c1 int,c2 int) partition by hash(c2) partitions 6;
|
||||
insert into t1 values(1,1);
|
||||
insert into t1 values(2,2);
|
||||
insert into t1 values(3,3);
|
||||
insert into t1 values(4,4);
|
||||
insert into t1 values(5,5);
|
||||
insert into t1 values(6,6);
|
||||
insert into t2 values(1,1);
|
||||
insert into t2 values(2,2);
|
||||
insert into t2 values(3,3);
|
||||
insert into t2 values(4,4);
|
||||
insert into t2 values(5,5);
|
||||
insert into t2 values(6,6);
|
||||
commit;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select * from t3 a ;
|
||||
c1 c2
|
||||
0 0
|
||||
5 4
|
||||
1 0
|
||||
6 5
|
||||
2 1
|
||||
3 2
|
||||
4 3
|
||||
select /*+ parallel(2) NO_USE_HASH_AGGREGATION */ a.c1,a.c2+a.c1 from t3 a group by a.c1,a.c2 order by a.c2+1+a.c1;
|
||||
c1 a.c2+a.c1
|
||||
0 0
|
||||
1 1
|
||||
2 3
|
||||
3 5
|
||||
4 7
|
||||
5 9
|
||||
6 11
|
||||
select /*+ parallel(2) pq_distribute(a hash hash) NO_USE_HASH_AGGREGATION */ a.c1,a.c2 from t3 a right outer join t3 b on a.c2=b.c1 order by a.c1,a.c2;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
0 0
|
||||
1 0
|
||||
2 1
|
||||
3 2
|
||||
4 3
|
||||
5 4
|
||||
6 5
|
||||
select /*+ parallel(2) pq_distribute(a hash hash) NO_USE_HASH_AGGREGATION */ a.c1,a.c2 from t3 a right outer join t3 b on a.c2+2=b.c1+1 order by a.c1,a.c2+2;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
0 0
|
||||
1 0
|
||||
2 1
|
||||
3 2
|
||||
4 3
|
||||
5 4
|
||||
6 5
|
||||
select /*+ parallel(2) pq_distribute(a hash hash) NO_USE_HASH_AGGREGATION */ a.c1,a.c2 from t3 a right outer join t3 b on abs(a.c2)+2=b.c1 order by a.c1,a.c2+2;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
NULL NULL
|
||||
0 0
|
||||
1 0
|
||||
2 1
|
||||
3 2
|
||||
4 3
|
||||
5 4
|
||||
select /*+ parallel(2) pq_distribute(b broadcast none) */ * from t1 a, t2 b where a.c1=b.c2 order by a.c1,b.c1;
|
||||
c1 c2 c1 c2
|
||||
1 1 1 1
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
4 4 4 4
|
||||
5 5 5 5
|
||||
6 6 6 6
|
||||
select /*+ parallel(2) pq_distribute(b broadcast none) */ * from t1 a, t2 b where a.c1+2=b.c2 + 1 order by a.c1,b.c1+2;
|
||||
c1 c2 c1 c2
|
||||
1 1 2 2
|
||||
2 2 3 3
|
||||
3 3 4 4
|
||||
4 4 5 5
|
||||
5 5 6 6
|
||||
select /*+ use_px parallel(2) */ c2,sum(c1) from (select a.c1,b.c2 from t5 a , t5 b where a.c1=b.c2) group by c2 order by 1,2;
|
||||
c2 sum(c1)
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
connection syscon;
|
||||
connection default;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
||||
@ -0,0 +1,128 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
// Case1: normal test,测试是否将带参数的case转为不带参数的case
|
||||
// Case2: 测试case表达式里面有列的情况
|
||||
// Case3: 测试空串以及NULL的情况
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
// Case1: normal test.
|
||||
// 所有带参数的case表达式都被转为不带参数的case表达式
|
||||
select case 1 when 1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
case 1 when 1 then 'a' when 2 then 'b' else 'c' end
|
||||
a
|
||||
// 应该命中else expr
|
||||
select case 100 when 1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
case 100 when 1 then 'a' when 2 then 'b' else 'c' end
|
||||
c
|
||||
|
||||
// MySQL允许各个when/then expr结果类型不一致
|
||||
// 1和'1'的类型不一致,会被加上cast,都被转为decimal再进行比较,返回'a'
|
||||
select case 1 when '1' then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
case 1 when '1' then 'a' when 2 then 'b' else 'c' end
|
||||
a
|
||||
// 第二个then 应该要加cast,返回'a'
|
||||
select case 1 when 1 then 'a' when 2 then 'b' else 3 end from dual;
|
||||
case 1 when 1 then 'a' when 2 then 'b' else 3 end
|
||||
a
|
||||
// 不带参数的case的测试
|
||||
// normal test
|
||||
// 应该返回'a'
|
||||
select case when 1=1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
case when 1=1 then 'a' when 2 then 'b' else 'c' end
|
||||
a
|
||||
// 应该返回'c'
|
||||
select case when 0=1 then 'a' when 0.0 then 'b' else 'c' end from dual;
|
||||
case when 0=1 then 'a' when 0.0 then 'b' else 'c' end
|
||||
c
|
||||
// 应该返回'a',且0='1'中要加cast
|
||||
select case when 1='1' then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
case when 1='1' then 'a' when 2 then 'b' else 'c' end
|
||||
a
|
||||
// 应该返回'c',且0='1'中要加cast
|
||||
select case when 0='1' then 'a' when 0.0 then 'b' else 'c' end from dual;
|
||||
case when 0='1' then 'a' when 0.0 then 'b' else 'c' end
|
||||
c
|
||||
// Case2: 测试建表的情况
|
||||
drop table if exists t1;
|
||||
create table t1 (col_null int, col_int int, col_char char);
|
||||
insert into t1 values(null, 1, 'a');
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
alter system flush plan cache global;
|
||||
// 测试int的normal case,应该返回'a'
|
||||
select case col_int when 1 then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
case col_int when 1 then 'a' when 2 then 'b' else 'c' end
|
||||
a
|
||||
// 测试int需要加cast的情况,第一个when需要加cast, 第二个when不需要
|
||||
select case col_int when '1' then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
case col_int when '1' then 'a' when 2 then 'b' else 'c' end
|
||||
a
|
||||
// 测试null的情况,应该返回'c',而且没有cast出现
|
||||
select case col_null when 1 then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
case col_null when 1 then 'a' when 2 then 'b' else 'c' end
|
||||
c
|
||||
// Case3: 测试空串以及NULL的情况
|
||||
// 应该返回1, MySQL没有把空串看成NULL
|
||||
select case '' when '' then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
case '' when '' then 1 when 'here' then 2 else 'hh' end
|
||||
1
|
||||
// 应该返回'hh'
|
||||
select case NULL when NULL then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
case NULL when NULL then 1 when 'here' then 2 else 'hh' end
|
||||
hh
|
||||
// 应该返回1, MySQL没有把空串看成NULL
|
||||
select case when '' = '' then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
case when '' = '' then 1 when 'here' then 2 else 'hh' end
|
||||
1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'here'
|
||||
// 应该返回'hh', 因为'here'cast为double会失败,返回值应该是0
|
||||
select case when NULL=NULL then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
case when NULL=NULL then 1 when 'here' then 2 else 'hh' end
|
||||
hh
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'here'
|
||||
// Case4: 测试不同字符集,大小写问题
|
||||
drop table t1;
|
||||
create table t1 (a varchar(100) collate utf8_general_ci, cond1 varchar(100) collate utf8_bin, cond2 varchar(100) collate utf8_general_ci);
|
||||
insert into t1 values('cond', 'COND', 'COND');
|
||||
// 返回Null,a和cond1以及a和cond2比较都会使用utf8_bin作为collation type(因为有aggregate collation的过程)
|
||||
select case a when cond1 then '1' when cond2 then '2' end from t1;
|
||||
case a when cond1 then '1' when cond2 then '2' end
|
||||
NULL
|
||||
// 返回'neq', a和cond1比较使用的是utf8_bin
|
||||
select case a when cond1 then 'eq' else 'neq' end from t1;
|
||||
case a when cond1 then 'eq' else 'neq' end
|
||||
neq
|
||||
// 返回'eq', a和cond1比较使用的是utf8_general_ci
|
||||
select case a when cond2 then 'eq' else 'neq' end from t1;
|
||||
case a when cond2 then 'eq' else 'neq' end
|
||||
eq
|
||||
// arg case子节点也是arg case的情况测试,应该都被改为case expr(应该返回'ok')
|
||||
select case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end from t1;
|
||||
case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end
|
||||
ok
|
||||
// Case5: show create view/table
|
||||
drop view if exists v1;
|
||||
drop table if exists t2;
|
||||
create view v1 as select case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end from t1;
|
||||
select * from v1;
|
||||
Name_exp_1
|
||||
ok
|
||||
// arg case expr的改写不应该影响show create view,结果应该还是arg case expr 而非改写后的case expr
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE VIEW `v1` AS select (case (case `test`.`t1`.`a` when 'cond' then 'eq' else 'neq' end) when 'eq' then 'ok' else 'not ok' end) AS `Name_exp_1` from `test`.`t1` utf8mb4 utf8mb4_general_ci
|
||||
drop view v1;
|
||||
create table t2 as select case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end from t1;
|
||||
select * from t2;
|
||||
case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end
|
||||
ok
|
||||
// arg case expr的改写不应该影响show create table,结果应该还是arg case expr 而非改写后的case expr
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end` varchar(6) NOT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = COMPACT COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
alter system set _enable_static_typing_engine = false;
|
||||
@ -0,0 +1,288 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
connection default;
|
||||
set ob_enable_plan_cache=false;
|
||||
drop table if exists t;
|
||||
create table t (tinyint_t tinyint,
|
||||
smallint_t smallint,
|
||||
mediumint_t mediumint,
|
||||
int32_t integer,
|
||||
bigint_t bigint,
|
||||
utinyint_t tinyint unsigned,
|
||||
usmallint_t smallint unsigned,
|
||||
umedium_t mediumint unsigned,
|
||||
uint32_t integer unsigned,
|
||||
ubigint_t bigint unsigned,
|
||||
float_t float,
|
||||
ufloat_t float unsigned,
|
||||
double_t double,
|
||||
udouble_t double unsigned,
|
||||
number_t number,
|
||||
unumber_t number unsigned,
|
||||
datetime_t datetime,
|
||||
timestamp_t timestamp,
|
||||
date_t date,
|
||||
time_t time,
|
||||
year_t year,
|
||||
varchar_t varchar(255),
|
||||
char_t char(255),
|
||||
tinytext_t tinytext,
|
||||
mediumtext_t mediumtext,
|
||||
longtext_t longtext,
|
||||
bit_t bit,
|
||||
enum_t enum('a', 'b', 'c'),
|
||||
set_t set('a', 'b', 'c'));
|
||||
insert into t values (NULL, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.00, 1.000, 1.0000, 1.00000, 1.000000,
|
||||
'1993-03-20', '1993-03-20', '1993-03-20', '10:10:10', '1993', '1.0', '1.00', '1.000', '1.0000',
|
||||
'1.00000', 1, 'b', 'b');
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
select NULL = tinyint_t from t limit 1;
|
||||
NULL = tinyint_t
|
||||
NULL
|
||||
select NULL = smallint_t from t limit 1;
|
||||
NULL = smallint_t
|
||||
NULL
|
||||
select NULL = mediumint_t from t limit 1;
|
||||
NULL = mediumint_t
|
||||
NULL
|
||||
select NULL = int32_t from t limit 1;
|
||||
NULL = int32_t
|
||||
NULL
|
||||
select NULL = bigint_t from t limit 1;
|
||||
NULL = bigint_t
|
||||
NULL
|
||||
select NULL = utinyint_t from t limit 1;
|
||||
NULL = utinyint_t
|
||||
NULL
|
||||
select NULL = usmallint_t from t limit 1;
|
||||
NULL = usmallint_t
|
||||
NULL
|
||||
select NULL = umedium_t from t limit 1;
|
||||
NULL = umedium_t
|
||||
NULL
|
||||
select NULL = uint32_t from t limit 1;
|
||||
NULL = uint32_t
|
||||
NULL
|
||||
select NULL = ubigint_t from t limit 1;
|
||||
NULL = ubigint_t
|
||||
NULL
|
||||
select NULL = float_t from t limit 1;
|
||||
NULL = float_t
|
||||
NULL
|
||||
select NULL = ufloat_t from t limit 1;
|
||||
NULL = ufloat_t
|
||||
NULL
|
||||
select NULL = double_t from t limit 1;
|
||||
NULL = double_t
|
||||
NULL
|
||||
select NULL = udouble_t from t limit 1;
|
||||
NULL = udouble_t
|
||||
NULL
|
||||
select NULL = number_t from t limit 1;
|
||||
NULL = number_t
|
||||
NULL
|
||||
select NULL = unumber_t from t limit 1;
|
||||
NULL = unumber_t
|
||||
NULL
|
||||
select NULL = datetime_t from t limit 1;
|
||||
NULL = datetime_t
|
||||
NULL
|
||||
select NULL = timestamp_t from t limit 1;
|
||||
NULL = timestamp_t
|
||||
NULL
|
||||
select NULL = date_t from t limit 1;
|
||||
NULL = date_t
|
||||
NULL
|
||||
select NULL = time_t from t limit 1;
|
||||
NULL = time_t
|
||||
NULL
|
||||
select NULL = year_t from t limit 1;
|
||||
NULL = year_t
|
||||
NULL
|
||||
select NULL = varchar_t from t limit 1;
|
||||
NULL = varchar_t
|
||||
NULL
|
||||
select NULL = char_t from t limit 1;
|
||||
NULL = char_t
|
||||
NULL
|
||||
select NULL = tinytext_t from t limit 1;
|
||||
NULL = tinytext_t
|
||||
NULL
|
||||
select NULL = mediumtext_t from t limit 1;
|
||||
NULL = mediumtext_t
|
||||
NULL
|
||||
select NULL = longtext_t from t limit 1;
|
||||
NULL = longtext_t
|
||||
NULL
|
||||
select NULL = bit_t from t limit 1;
|
||||
NULL = bit_t
|
||||
NULL
|
||||
select NULL = enum_t from t limit 1;
|
||||
NULL = enum_t
|
||||
NULL
|
||||
select NULL = set_t from t limit 1;
|
||||
NULL = set_t
|
||||
NULL
|
||||
select tinyint_t = tinyint_t from t limit 1;
|
||||
tinyint_t = tinyint_t
|
||||
NULL
|
||||
select tinyint_t = smallint_t from t limit 1;
|
||||
tinyint_t = smallint_t
|
||||
NULL
|
||||
select tinyint_t = mediumint_t from t limit 1;
|
||||
tinyint_t = mediumint_t
|
||||
NULL
|
||||
select tinyint_t = int32_t from t limit 1;
|
||||
tinyint_t = int32_t
|
||||
NULL
|
||||
select tinyint_t = bigint_t from t limit 1;
|
||||
tinyint_t = bigint_t
|
||||
NULL
|
||||
select tinyint_t = utinyint_t from t limit 1;
|
||||
tinyint_t = utinyint_t
|
||||
NULL
|
||||
select tinyint_t = usmallint_t from t limit 1;
|
||||
tinyint_t = usmallint_t
|
||||
NULL
|
||||
select tinyint_t = umedium_t from t limit 1;
|
||||
tinyint_t = umedium_t
|
||||
NULL
|
||||
select tinyint_t = uint32_t from t limit 1;
|
||||
tinyint_t = uint32_t
|
||||
NULL
|
||||
select tinyint_t = ubigint_t from t limit 1;
|
||||
tinyint_t = ubigint_t
|
||||
NULL
|
||||
select tinyint_t = float_t from t limit 1;
|
||||
tinyint_t = float_t
|
||||
NULL
|
||||
select tinyint_t = ufloat_t from t limit 1;
|
||||
tinyint_t = ufloat_t
|
||||
NULL
|
||||
select tinyint_t = double_t from t limit 1;
|
||||
tinyint_t = double_t
|
||||
NULL
|
||||
select tinyint_t = udouble_t from t limit 1;
|
||||
tinyint_t = udouble_t
|
||||
NULL
|
||||
select tinyint_t = number_t from t limit 1;
|
||||
tinyint_t = number_t
|
||||
NULL
|
||||
select tinyint_t = unumber_t from t limit 1;
|
||||
tinyint_t = unumber_t
|
||||
NULL
|
||||
select tinyint_t = datetime_t from t limit 1;
|
||||
tinyint_t = datetime_t
|
||||
NULL
|
||||
select tinyint_t = timestamp_t from t limit 1;
|
||||
tinyint_t = timestamp_t
|
||||
NULL
|
||||
select tinyint_t = date_t from t limit 1;
|
||||
tinyint_t = date_t
|
||||
NULL
|
||||
select tinyint_t = time_t from t limit 1;
|
||||
tinyint_t = time_t
|
||||
NULL
|
||||
select tinyint_t = year_t from t limit 1;
|
||||
tinyint_t = year_t
|
||||
NULL
|
||||
select tinyint_t = varchar_t from t limit 1;
|
||||
tinyint_t = varchar_t
|
||||
NULL
|
||||
select tinyint_t = char_t from t limit 1;
|
||||
tinyint_t = char_t
|
||||
NULL
|
||||
select tinyint_t = tinytext_t from t limit 1;
|
||||
tinyint_t = tinytext_t
|
||||
NULL
|
||||
select tinyint_t = mediumtext_t from t limit 1;
|
||||
tinyint_t = mediumtext_t
|
||||
NULL
|
||||
select tinyint_t = longtext_t from t limit 1;
|
||||
tinyint_t = longtext_t
|
||||
NULL
|
||||
select tinyint_t = bit_t from t limit 1;
|
||||
tinyint_t = bit_t
|
||||
NULL
|
||||
select tinyint_t = enum_t from t limit 1;
|
||||
tinyint_t = enum_t
|
||||
NULL
|
||||
select tinyint_t = set_t from t limit 1;
|
||||
tinyint_t = set_t
|
||||
NULL
|
||||
Row With NULL
|
||||
select (1, 1) = (1, null) from dual;
|
||||
(1, 1) = (1, null)
|
||||
NULL
|
||||
select (1, 1) = (2, null) from dual;
|
||||
(1, 1) = (2, null)
|
||||
0
|
||||
select (1, 1) < (1, null) from dual;
|
||||
(1, 1) < (1, null)
|
||||
NULL
|
||||
select (1, 1) < (2, null) from dual;
|
||||
(1, 1) < (2, null)
|
||||
1
|
||||
select (1, 1) <= (1, null) from dual;
|
||||
(1, 1) <= (1, null)
|
||||
NULL
|
||||
select (1, 1) <= (2, null) from dual;
|
||||
(1, 1) <= (2, null)
|
||||
1
|
||||
select (1, 1) > (1, null) from dual;
|
||||
(1, 1) > (1, null)
|
||||
NULL
|
||||
select (1, 1) > (2, null) from dual;
|
||||
(1, 1) > (2, null)
|
||||
0
|
||||
select (1, 1) >= (1, null) from dual;
|
||||
(1, 1) >= (1, null)
|
||||
NULL
|
||||
select (1, 1) >= (2, null) from dual;
|
||||
(1, 1) >= (2, null)
|
||||
0
|
||||
select (1, 1) != (1, null) from dual;
|
||||
(1, 1) != (1, null)
|
||||
NULL
|
||||
select (1, 1) != (2, null) from dual;
|
||||
(1, 1) != (2, null)
|
||||
1
|
||||
select (1, 1) = (1, tinyint_t) from t limit 1;
|
||||
(1, 1) = (1, tinyint_t)
|
||||
NULL
|
||||
select (1, 1) = (2, tinyint_t) from t limit 1;
|
||||
(1, 1) = (2, tinyint_t)
|
||||
0
|
||||
select (1, 1) < (1, tinyint_t) from t limit 1;
|
||||
(1, 1) < (1, tinyint_t)
|
||||
NULL
|
||||
select (1, 1) < (2, tinyint_t) from t limit 1;
|
||||
(1, 1) < (2, tinyint_t)
|
||||
1
|
||||
select (1, 1) <= (1, tinyint_t) from t limit 1;
|
||||
(1, 1) <= (1, tinyint_t)
|
||||
NULL
|
||||
select (1, 1) <= (2, tinyint_t) from t limit 1;
|
||||
(1, 1) <= (2, tinyint_t)
|
||||
1
|
||||
select (1, 1) > (1, tinyint_t) from t limit 1;
|
||||
(1, 1) > (1, tinyint_t)
|
||||
NULL
|
||||
select (1, 1) > (2, tinyint_t) from t limit 1;
|
||||
(1, 1) > (2, tinyint_t)
|
||||
0
|
||||
select (1, 1) >= (1, tinyint_t) from t limit 1;
|
||||
(1, 1) >= (1, tinyint_t)
|
||||
NULL
|
||||
select (1, 1) >= (2, tinyint_t) from t limit 1;
|
||||
(1, 1) >= (2, tinyint_t)
|
||||
0
|
||||
select (1, 1) != (1, tinyint_t) from t limit 1;
|
||||
(1, 1) != (1, tinyint_t)
|
||||
NULL
|
||||
select (1, 1) != (2, tinyint_t) from t limit 1;
|
||||
(1, 1) != (2, tinyint_t)
|
||||
1
|
||||
connection conn_admin;
|
||||
@ -0,0 +1,46 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system set enable_async_syslog = false;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
create table t1(c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 bigint, c6 tinyint unsigned, c7 smallint unsigned, c8 mediumint unsigned, c9 int unsigned, c10 bigint unsigned, c11 float, c12 double, c13 float unsigned, c14 double unsigned);
|
||||
insert into t1 values(null,null,null,null,null,null,null,null,null,null,null,null,null,null);
|
||||
insert into t1 values(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11.1, 12.2, 13.3, 14.4);
|
||||
create table t2(c1 date, c2 time, c3 datetime, c4 timestamp, c5 year);
|
||||
insert into t2 values(null,null,null,null,null);
|
||||
insert into t2 values('0000-00-00', '12:34:56', '2019-12-25 12:34:56', '2019-12-25 12:34:56', 2020);
|
||||
create table t3(c1 char(10), c2 varchar(10), c3 binary(10), c4 varbinary(10), c5 blob, c6 text, c7 enum('','abc'), c8 set('','abc'));
|
||||
insert into t3 values(null,null,null,null,null,null,null,null);
|
||||
insert into t3 values('abc', 'abc', 'abc', 'abc', 'abc', 'abc', 'abc', 'abc');
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
select c1, partition_key_v2(null), partition_key_v2(c1), partition_key_v2(c2), partition_key_v2(c3), partition_key_v2(c4), partition_key_v2(c5), partition_key_v2(c6), partition_key_v2(c7), partition_key_v2(c8), partition_key_v2(c9), partition_key_v2(c10), partition_key_v2(c11), partition_key_v2(c12), partition_key_v2(c13), partition_key_v2(c14) from t1;
|
||||
c1 partition_key_v2(null) partition_key_v2(c1) partition_key_v2(c2) partition_key_v2(c3) partition_key_v2(c4) partition_key_v2(c5) partition_key_v2(c6) partition_key_v2(c7) partition_key_v2(c8) partition_key_v2(c9) partition_key_v2(c10) partition_key_v2(c11) partition_key_v2(c12) partition_key_v2(c13) partition_key_v2(c14)
|
||||
NULL 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575
|
||||
1 6960269033020761575 8089716718896805586 4083905729319787502 5173830478357570162 4802761344231991206 208465272938114760 3091397795597481564 6469252686979372057 5312865287321056581 3253817828616337504 7188666914263997357 554171766401687642 1209923708429642637 3652659264439090126 1116622728199546839
|
||||
select partition_key_v2(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14) from t1;
|
||||
partition_key_v2(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14)
|
||||
8669936285899323595
|
||||
3319342296135249634
|
||||
select c1, partition_key_v2(c1), partition_key_v2(c2), partition_key_v2(c3), partition_key_v2(c4), partition_key_v2(c5) from t2;
|
||||
c1 partition_key_v2(c1) partition_key_v2(c2) partition_key_v2(c3) partition_key_v2(c4) partition_key_v2(c5)
|
||||
NULL 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575
|
||||
0000-00-00 4118494407655268559 7068692680032799961 905094948208870081 6483578642322323262 1051853082033653591
|
||||
select partition_key_v2(c1, c2, c3, c4, c5 from t2;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'from t2' at line 1
|
||||
select c1, partition_key_v2(c1), partition_key_v2(c2), partition_key_v2(c3), partition_key_v2(c4), partition_key_v2(c5), partition_key_v2(c6), partition_key_v2(c7), partition_key_v2(c8) from t3;
|
||||
c1 partition_key_v2(c1) partition_key_v2(c2) partition_key_v2(c3) partition_key_v2(c4) partition_key_v2(c5) partition_key_v2(c6) partition_key_v2(c7) partition_key_v2(c8)
|
||||
NULL 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575
|
||||
abc 258901174748407223 258901174748407223 1050281475281956529 7076783908008484943 7076783908008484943 258901174748407223 4083905729319787502 4083905729319787502
|
||||
select partition_key_v2(c1, c2, c3, c4, c5, c6, c7, c8) from t3;
|
||||
partition_key_v2(c1, c2, c3, c4, c5, c6, c7, c8)
|
||||
6029179996760524639
|
||||
644396205906272596
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
@ -0,0 +1,258 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
create table t1 (c1 int primary key, c2 decimal, c3 int, c4 varchar(20));
|
||||
create table t2 (c1 int primary key, c2 decimal, c3 int, c4 varchar(20));
|
||||
insert into t1 (c1, c2, c3, c4) values (1, 1, 1, 'a');
|
||||
insert into t1 (c1, c2, c3, c4) values (2, 2, null, 'a');
|
||||
insert into t1 (c1, c2, c3, c4) values (3, 3, null, 'a');
|
||||
insert into t2 (c1, c2, c3, c4) values (1, 1, 1, 'a');
|
||||
insert into t2 (c1, c2, c3, c4) values (2, 2, null, 'a');
|
||||
insert into t2 (c1, c2, c3, c4) values (3, 3, null, 'a');
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
set ob_enable_transformation = off;
|
||||
select (1, 1) = (1, 0);
|
||||
(1, 1) = (1, 0)
|
||||
0
|
||||
select (1, 1) = (1, 1);
|
||||
(1, 1) = (1, 1)
|
||||
1
|
||||
select 1 <=> 1;
|
||||
1 <=> 1
|
||||
1
|
||||
select 1 <=> 0;
|
||||
1 <=> 0
|
||||
0
|
||||
select 1 <=> null;
|
||||
1 <=> null
|
||||
0
|
||||
select null <=> 1;
|
||||
null <=> 1
|
||||
0
|
||||
select null <=> null;
|
||||
null <=> null
|
||||
1
|
||||
select (1, 1) <=> (1, 1);
|
||||
(1, 1) <=> (1, 1)
|
||||
1
|
||||
select (1, null) <=> (1, 1);
|
||||
(1, null) <=> (1, 1)
|
||||
0
|
||||
select (1, null) <=> (1, null);
|
||||
(1, null) <=> (1, null)
|
||||
1
|
||||
select (1, null) <=> (null, null);
|
||||
(1, null) <=> (null, null)
|
||||
0
|
||||
select (null, null) <=> (null, null);
|
||||
(null, null) <=> (null, null)
|
||||
1
|
||||
select (select c1, c2 from t1 where c1 = 1) = (1, 1) from t2 where c1 = 1;
|
||||
(select c1, c2 from t1 where c1 = 1) = (1, 1)
|
||||
1
|
||||
select (select c1, c2 from t1 where c1 = 1) = (c2, c1) from t2 where c1 = 1;
|
||||
(select c1, c2 from t1 where c1 = 1) = (c2, c1)
|
||||
1
|
||||
select (select c1 from t1 where c1 = 1) + 1 from t2 where c1 = 1;
|
||||
(select c1 from t1 where c1 = 1) + 1
|
||||
2
|
||||
select (select c1 from t1 where 1 = 0) + 1 from t2 where c1 = 1;
|
||||
(select c1 from t1 where 1 = 0) + 1
|
||||
NULL
|
||||
select c2 in (select c2 from t2) from t1;
|
||||
c2 in (select c2 from t2)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 = any(select c2 from t2) from t1;
|
||||
c2 = any(select c2 from t2)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 != any(select c2 from t2) from t1;
|
||||
c2 != any(select c2 from t2)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 < any(select c2 from t2) from t1;
|
||||
c2 < any(select c2 from t2)
|
||||
1
|
||||
1
|
||||
0
|
||||
select c2 <= any(select c2 from t2) from t1;
|
||||
c2 <= any(select c2 from t2)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 > any(select c2 from t2) from t1;
|
||||
c2 > any(select c2 from t2)
|
||||
0
|
||||
1
|
||||
1
|
||||
select c2 >= any(select c2 from t2) from t1;
|
||||
c2 >= any(select c2 from t2)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 <=> any(select c2 from t2) from t1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '(select c2 from t2) from t1' at line 1
|
||||
select exists (select * from t2), not exists (select * from t2) from t1;
|
||||
exists (select * from t2) not exists (select * from t2)
|
||||
1 0
|
||||
1 0
|
||||
1 0
|
||||
select exists (select * from t2 where 1 = 0), not exists (select * from t2 where 1 = 0) from t1;
|
||||
exists (select * from t2 where 1 = 0) not exists (select * from t2 where 1 = 0)
|
||||
0 1
|
||||
0 1
|
||||
0 1
|
||||
select c2 = all (select c2 from t2) from t1;
|
||||
c2 = all (select c2 from t2)
|
||||
0
|
||||
0
|
||||
0
|
||||
select c2 = any (select c2 from t2) from t1;
|
||||
c2 = any (select c2 from t2)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 = all (select c3 from t2) from t1;
|
||||
c2 = all (select c3 from t2)
|
||||
NULL
|
||||
0
|
||||
0
|
||||
select c2 = any (select c3 from t2) from t1;
|
||||
c2 = any (select c3 from t2)
|
||||
1
|
||||
NULL
|
||||
NULL
|
||||
select c3 = all (select c2 from t2) from t1;
|
||||
c3 = all (select c2 from t2)
|
||||
0
|
||||
NULL
|
||||
NULL
|
||||
select c3 = any (select c2 from t2) from t1;
|
||||
c3 = any (select c2 from t2)
|
||||
1
|
||||
NULL
|
||||
NULL
|
||||
select c3 <=> (select c2 from t2) from t1;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
select (c1, c3) = all (select c1, c2 from t2) from t1;
|
||||
(c1, c3) = all (select c1, c2 from t2)
|
||||
0
|
||||
0
|
||||
0
|
||||
select (c1, c3) = any (select c1, c2 from t2) from t1;
|
||||
(c1, c3) = any (select c1, c2 from t2)
|
||||
1
|
||||
NULL
|
||||
NULL
|
||||
select (c1, c3) <=> (select c1, c2 from t2) from t1;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
select exists (select 1);
|
||||
exists (select 1)
|
||||
1
|
||||
select not exists (select 1);
|
||||
not exists (select 1)
|
||||
0
|
||||
select 1 from dual where exists (select c1 from t2);
|
||||
1
|
||||
1
|
||||
select 1 from dual where not exists (select c1 from t2);
|
||||
1
|
||||
select * from t1 where exists (select * from t2 where c1 < 0);
|
||||
c1 c2 c3 c4
|
||||
select * from t1 where exists (select * from t2 where c1 > 0);
|
||||
c1 c2 c3 c4
|
||||
1 1 1 a
|
||||
2 2 NULL a
|
||||
3 3 NULL a
|
||||
select (select c1, c2 from t1 where c1 = 1) = (select c1, c2 from t2 where c1 = 1);
|
||||
(select c1, c2 from t1 where c1 = 1) = (select c1, c2 from t2 where c1 = 1)
|
||||
1
|
||||
select (select c1, c2 from t1 where c1 = 0) = (select c1, c2 from t2 where c1 = 1);
|
||||
(select c1, c2 from t1 where c1 = 0) = (select c1, c2 from t2 where c1 = 1)
|
||||
NULL
|
||||
select (select c1, c2 from t1 where c1 = 1) = (select c1, c2 from t2 where c1 = 0);
|
||||
(select c1, c2 from t1 where c1 = 1) = (select c1, c2 from t2 where c1 = 0)
|
||||
NULL
|
||||
select (select c1, c2 from t1 where c1 = 0) = (select c1, c2 from t2 where c1 = 0);
|
||||
(select c1, c2 from t1 where c1 = 0) = (select c1, c2 from t2 where c1 = 0)
|
||||
NULL
|
||||
select (select c1, c2 from t1 where c1 = 1) <=> (select c1, c2 from t2 where c1 = 1);
|
||||
(select c1, c2 from t1 where c1 = 1) <=> (select c1, c2 from t2 where c1 = 1)
|
||||
1
|
||||
select (select c1, c2 from t1 where c1 = 0) <=> (select c1, c2 from t2 where c1 = 1);
|
||||
(select c1, c2 from t1 where c1 = 0) <=> (select c1, c2 from t2 where c1 = 1)
|
||||
0
|
||||
select (select c1, c2 from t1 where c1 = 1) <=> (select c1, c2 from t2 where c1 = 0);
|
||||
(select c1, c2 from t1 where c1 = 1) <=> (select c1, c2 from t2 where c1 = 0)
|
||||
0
|
||||
select (select c1, c2 from t1 where c1 = 0) <=> (select c1, c2 from t2 where c1 = 0);
|
||||
(select c1, c2 from t1 where c1 = 0) <=> (select c1, c2 from t2 where c1 = 0)
|
||||
1
|
||||
select (select c1, c2 from t1 where c1 > 1) = (select c1, c2 from t2 where c1 = 1);
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
select (select c1, c2 from t1 where c1 = 1) = (select c1, c2 from t2 where c1 > 1);
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
select (select c1, c2 from t1 where c1 > 1) = (select c1, c2 from t2 where c1 > 1);
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
select c1 + (select c2 from t2 where c1 = 2), c2 in (select c3 from t2) from t1;
|
||||
c1 + (select c2 from t2 where c1 = 2) c2 in (select c3 from t2)
|
||||
3 1
|
||||
4 NULL
|
||||
5 NULL
|
||||
select c1 + (select c2 from t2 where c1 = t1.c2 and c3 <= t1.c2) from t1;
|
||||
c1 + (select c2 from t2 where c1 = t1.c2 and c3 <= t1.c2)
|
||||
2
|
||||
NULL
|
||||
NULL
|
||||
select * from t1 where c1 + (select c2 from t2 where c1 = t1.c2 and c3 <= t1.c2) < 10;
|
||||
c1 c2 c3 c4
|
||||
1 1 1 a
|
||||
select (select c1, c2 from t2 where c1 = 1) = (c2, c1) from t1;
|
||||
(select c1, c2 from t2 where c1 = 1) = (c2, c1)
|
||||
1
|
||||
0
|
||||
0
|
||||
select (select c1, c2 from t2 where c1 = 1) = (c1, c2) from t1;
|
||||
(select c1, c2 from t2 where c1 = 1) = (c1, c2)
|
||||
1
|
||||
0
|
||||
0
|
||||
select (c2, c1) <= (select c1, c2 from t2 where c1 = 1) from t1;
|
||||
(c2, c1) <= (select c1, c2 from t2 where c1 = 1)
|
||||
1
|
||||
0
|
||||
0
|
||||
select (c1, c2) <= (select c1, c2 from t2 where c1 = 1) from t1;
|
||||
(c1, c2) <= (select c1, c2 from t2 where c1 = 1)
|
||||
1
|
||||
0
|
||||
0
|
||||
select (select c2, c1 from t2 where c1 = 2) >= (select c1, c2 from t2 where c1 = 1) from t1;
|
||||
(select c2, c1 from t2 where c1 = 2) >= (select c1, c2 from t2 where c1 = 1)
|
||||
1
|
||||
1
|
||||
1
|
||||
select (select c1, c1 from t2 where c1 = 2) >= (select c1, c2 from t2 where c1 = 1) from t1;
|
||||
(select c1, c1 from t2 where c1 = 2) >= (select c1, c2 from t2 where c1 = 1)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 > (select c1 from t2 where c3 is not null) from t1;
|
||||
c2 > (select c1 from t2 where c3 is not null)
|
||||
0
|
||||
1
|
||||
1
|
||||
select * from t1 where c2 + (select c1 from t2 where c1 = t1.c2) < 10;
|
||||
c1 c2 c3 c4
|
||||
1 1 1 a
|
||||
2 2 NULL a
|
||||
3 3 NULL a
|
||||
set ob_enable_transformation = on;
|
||||
connection syscon;
|
||||
@ -0,0 +1,128 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int);
|
||||
insert into t1 (c1, c2) values (1, 1);
|
||||
insert into t1 (c1, c2) values (1, 1);
|
||||
insert into t1 (c1, c2) values (1, 2);
|
||||
insert into t1 (c1, c2) values (10, 10);
|
||||
insert into t1 (c1, c2) values (10, 10);
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
explain select c2, sum(c1) from (select distinct c2, c1 from t1) x group by c2;
|
||||
Query Plan
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------------
|
||||
|0 |MERGE GROUP BY | |5 |45 |
|
||||
|1 | SUBPLAN SCAN |x |5 |44 |
|
||||
|2 | MERGE DISTINCT| |5 |43 |
|
||||
|3 | SORT | |5 |42 |
|
||||
|4 | TABLE SCAN |t1 |5 |37 |
|
||||
=========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([x.c2], [T_FUN_SUM(x.c1)]), filter(nil),
|
||||
group([x.c2]), agg_func([T_FUN_SUM(x.c1)])
|
||||
1 - output([x.c2], [x.c1]), filter(nil),
|
||||
access([x.c2], [x.c1])
|
||||
2 - output([t1.c2], [t1.c1]), filter(nil),
|
||||
distinct([t1.c2], [t1.c1])
|
||||
3 - output([t1.c2], [t1.c1]), filter(nil), sort_keys([t1.c2, ASC], [t1.c1, ASC])
|
||||
4 - output([t1.c2], [t1.c1]), filter(nil),
|
||||
access([t1.c2], [t1.c1]), partitions(p0)
|
||||
|
||||
select c2, sum(c1) from (select distinct c2, c1 from t1) x group by c2;
|
||||
c2 sum(c1)
|
||||
1 1
|
||||
2 1
|
||||
10 10
|
||||
explain select c2, sum(c1 + c2) from (select distinct c2, c1 from t1) x group by c2;
|
||||
Query Plan
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------------
|
||||
|0 |MERGE GROUP BY | |5 |45 |
|
||||
|1 | SUBPLAN SCAN |x |5 |44 |
|
||||
|2 | MERGE DISTINCT| |5 |43 |
|
||||
|3 | SORT | |5 |42 |
|
||||
|4 | TABLE SCAN |t1 |5 |37 |
|
||||
=========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([x.c2], [T_FUN_SUM(x.c1 + x.c2)]), filter(nil),
|
||||
group([x.c2]), agg_func([T_FUN_SUM(x.c1 + x.c2)])
|
||||
1 - output([x.c2], [x.c1 + x.c2]), filter(nil),
|
||||
access([x.c2], [x.c1])
|
||||
2 - output([t1.c2], [t1.c1]), filter(nil),
|
||||
distinct([t1.c2], [t1.c1])
|
||||
3 - output([t1.c2], [t1.c1]), filter(nil), sort_keys([t1.c2, ASC], [t1.c1, ASC])
|
||||
4 - output([t1.c2], [t1.c1]), filter(nil),
|
||||
access([t1.c2], [t1.c1]), partitions(p0)
|
||||
|
||||
select c2, sum(c1 + c2) from (select distinct c2, c1 from t1) x group by c2;
|
||||
c2 sum(c1 + c2)
|
||||
1 2
|
||||
2 3
|
||||
10 20
|
||||
explain select c2, sum(c1 + c2), max(c3) from (select c1, c2, c1 + 2 as c3 from (select distinct c2, c1 from t1) x ) y group by c2;
|
||||
Query Plan
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------------
|
||||
|0 |MERGE GROUP BY | |5 |46 |
|
||||
|1 | SUBPLAN SCAN |x |5 |44 |
|
||||
|2 | MERGE DISTINCT| |5 |43 |
|
||||
|3 | SORT | |5 |42 |
|
||||
|4 | TABLE SCAN |t1 |5 |37 |
|
||||
=========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([x.c2], [T_FUN_SUM(x.c1 + x.c2)], [T_FUN_MAX(x.c1 + 2)]), filter(nil),
|
||||
group([x.c2]), agg_func([T_FUN_SUM(x.c1 + x.c2)], [T_FUN_MAX(x.c1 + 2)])
|
||||
1 - output([x.c2], [x.c1 + x.c2], [x.c1 + 2]), filter(nil),
|
||||
access([x.c1], [x.c2])
|
||||
2 - output([t1.c2], [t1.c1]), filter(nil),
|
||||
distinct([t1.c2], [t1.c1])
|
||||
3 - output([t1.c2], [t1.c1]), filter(nil), sort_keys([t1.c2, ASC], [t1.c1, ASC])
|
||||
4 - output([t1.c2], [t1.c1]), filter(nil),
|
||||
access([t1.c2], [t1.c1]), partitions(p0)
|
||||
|
||||
select c2, sum(c1 + c2), max(c3) from (select c1, c2, c1 + 2 as c3 from (select distinct c2, c1 from t1) x ) y group by c2;
|
||||
c2 sum(c1 + c2) max(c3)
|
||||
1 2 3
|
||||
2 3 3
|
||||
10 20 12
|
||||
explain select * from t1 where c2 in (select 1 from t1);
|
||||
Query Plan
|
||||
=======================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
---------------------------------------
|
||||
|0 |HASH JOIN | |1 |77 |
|
||||
|1 | SUBPLAN SCAN|VIEW1|1 |37 |
|
||||
|2 | TABLE SCAN |t1 |1 |36 |
|
||||
|3 | TABLE SCAN |t1 |5 |37 |
|
||||
=======================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2]), filter(nil),
|
||||
equal_conds([t1.c2 = VIEW1.1]), other_conds(nil)
|
||||
1 - output([VIEW1.1]), filter(nil),
|
||||
access([VIEW1.1])
|
||||
2 - output([1]), filter(nil),
|
||||
access([t1.__pk_increment]), partitions(p0),
|
||||
limit(1), offset(nil)
|
||||
3 - output([t1.c2], [t1.c1]), filter(nil),
|
||||
access([t1.c2], [t1.c1]), partitions(p0)
|
||||
|
||||
select * from t1 where c2 in (select 1 from t1);
|
||||
c1 c2
|
||||
1 1
|
||||
1 1
|
||||
connection syscon;
|
||||
@ -0,0 +1,132 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system set enable_async_syslog = false;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (c1 int primary key, c2 int unsigned,
|
||||
c3 tinyint, c4 tinyint unsigned,
|
||||
c5 smallint, c6 smallint unsigned,
|
||||
c7 mediumint, c8 mediumint unsigned,
|
||||
c9 integer, c10 integer unsigned,
|
||||
c11 bigint, c12 bigint unsigned,
|
||||
c13 float, c14 float unsigned,
|
||||
c15 double, c16 double unsigned,
|
||||
c17 decimal, c18 decimal unsigned,
|
||||
c19 datetime, c20 timestamp,
|
||||
c21 varchar(30), c22 char(30));
|
||||
insert into t1 values(1, 1, 1, 1, -1, 6, 7, 8, 9, 10, -11, 12, -13.1, 14.2, -15.01, 16.10, 17.001, 18.002, '2019-10-10 10:00:00', '2019-10-10 10:00:00', '21varchar', '22char');
|
||||
insert into t1 values('2', '1', '1', '1', '-1', '6', '7', '8', '9', '10', '-11', '12', '-13.1', '14.2', '-15.01', '16.10', '17.001', '18.002', '2019-10-10 10:00:00', '2019-10-10 10:00:00', '21varchar', '22char');
|
||||
insert into t1 values('3', '1', '1', '1', '-1', '6', '7', '8', '9', '10', '-11', '12', '-13.1', '14.2', '-15.01', '16.10', '17.001', '18.002', '2019-10-10 10:00:00', '2019-10-10 10:00:00', '21varchar', '22char'), ('4', '1', '1', '1', '-1', '16', '17', '18', '19', '11', '-11', '121', '-13.11', '14.21', '-15.011', '16.101', '17.1001', '18.1002', '2019-10-10 10:00:00.00', '2019-10-10 10:00:00.000', '21varchar1', '22char1');
|
||||
select * from t1;
|
||||
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22
|
||||
1 1 1 1 -1 6 7 8 9 10 -11 12 -13.1 14.2 -15.01 16.1 17 18 2019-10-10 10:00:00 2019-10-10 10:00:00 21varchar 22char
|
||||
2 1 1 1 -1 6 7 8 9 10 -11 12 -13.1 14.2 -15.01 16.1 17 18 2019-10-10 10:00:00 2019-10-10 10:00:00 21varchar 22char
|
||||
3 1 1 1 -1 6 7 8 9 10 -11 12 -13.1 14.2 -15.01 16.1 17 18 2019-10-10 10:00:00 2019-10-10 10:00:00 21varchar 22char
|
||||
4 1 1 1 -1 16 17 18 19 11 -11 121 -13.11 14.21 -15.011 16.101 17 18 2019-10-10 10:00:00 2019-10-10 10:00:00 21varchar1 22char1
|
||||
set @@ob_enable_plan_cache = 1;
|
||||
// test ObDatumCaster::to_type() in ObExprValuesOp
|
||||
drop table t1;
|
||||
create table t1(c1 varchar(100) collate utf16_bin,
|
||||
c2 varchar(100) collate utf8_general_ci,
|
||||
c3 char(100) collate utf16_bin,
|
||||
c4 char(100) collate utf8_general_ci);
|
||||
ERROR HY000: Unknown collation: 'utf16_bin'
|
||||
// different value type, but will use same plan, so will to ObDatumCaster::to_type()
|
||||
insert into t1 values(123, 123, 123, 123);
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
insert into t1 values(null, 123, null, 123);
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
insert into t1 values('123', '123', '123', 123);
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
insert into t1 values('', '123', '123', 123);
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
select c1, length(c1),
|
||||
c2, length(c2),
|
||||
c3, length(c3),
|
||||
c4, length(c4) from t1;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
// insert decimal/int using different collation string
|
||||
delete from t1;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
insert into t1 values('123.123', '123.123', '123.123', '123.123');
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
create table t2(c1 decimal(10, 1), c2 int unsigned, c3 int);
|
||||
insert into t2 values(null, null, 1);
|
||||
insert into t2 select null, null, null from dual;
|
||||
insert into t2 select c1, c1, c1 from t1;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
insert into t2 select c2, c2, c2 from t1;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
insert into t2 select c3, c3, c3 from t1;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
insert into t2 select c4, c4, c4 from t1;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
select * from t2;
|
||||
c1 c2 c3
|
||||
NULL NULL 1
|
||||
NULL NULL NULL
|
||||
// test enumset
|
||||
drop table t1;
|
||||
ERROR 42S02: Unknown table 'test.t1'
|
||||
create table t1(c1 enum('a', 'b', 'c'), c2 set('a', 'b', 'c'));
|
||||
insert into t1 values(1, 1), (2, 2);
|
||||
select * from t1;
|
||||
c1 c2
|
||||
a a
|
||||
b b
|
||||
drop table t2;
|
||||
create table t2(col_utf16 varchar(100) collate utf16_bin,
|
||||
col_gbk varchar(100) collate gbk_chinese_ci,
|
||||
col_utf8 varchar(100) collate utf8_general_ci);
|
||||
ERROR HY000: Unknown collation: 'utf16_bin'
|
||||
insert into t2 values('a', 'a', 'a');
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
// insert enum/set using different collation string
|
||||
insert into t1 select col_utf16, col_utf16 from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
insert into t1 select col_gbk, col_gbk from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
insert into t1 select col_utf8, col_utf8 from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
select * from t1;
|
||||
c1 c2
|
||||
a a
|
||||
b b
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
insert into t1 values('a', 'b'), ('b', 'c');
|
||||
select * from t1;
|
||||
c1 c2
|
||||
a b
|
||||
b c
|
||||
// insert different collation string using enum/set
|
||||
insert into t2 select c1, c1, c1 from t1;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
insert into t2 select c2, c2, c2 from t1;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
select * from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
delete from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
// test again(using different column)
|
||||
insert into t2 select c1, c2, c1 from t1;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
insert into t2 select c2, c2, c1 from t1;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
insert into t2 select c1, c1, c2 from t1;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
select * from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
ERROR 42S02: Unknown table 'test.t2'
|
||||
drop table if exists t2;
|
||||
create table t2 (c1 int primary key, c2 int) partition by hash(c1) partitions 3;
|
||||
insert into t2 select -127,30 from dual;
|
||||
select * from t2 partition (p1);
|
||||
c1 c2
|
||||
-127 30
|
||||
drop table t2;
|
||||
connection conn_admin;
|
||||
@ -0,0 +1,86 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 number, c2 number, c3 char(20), c4 varchar(20), primary key(c1, c2), index i1 (c2));
|
||||
insert into t1 (c1, c2, c3, c4) values (1, 2, 'a', 'b');
|
||||
insert into t1 (c1, c2, c3, c4) values (3, 4, 'c', 'd');
|
||||
insert into t1 (c1, c2, c3, c4) values (5, 1, 'xx', 'yy');
|
||||
insert into t1 (c1, c2, c3, c4) values (5, 2, 'xx', 'yy');
|
||||
insert into t1 (c1, c2, c3, c4) values (7, 5, 'xx1', 'yy2');
|
||||
insert into t1 (c1, c2, c3, c4) values (7, 6, 'xx1', 'yy2');
|
||||
insert into t1 (c1, c2, c3, c4) values (8, 7, 'xx1', 'yy2');
|
||||
alter table t1 add column c5 varchar(20) default 'c5_default';
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select * from t1;
|
||||
c1 c2 c3 c4 c5
|
||||
1 2 a b c5_default
|
||||
3 4 c d c5_default
|
||||
5 1 xx yy c5_default
|
||||
5 2 xx yy c5_default
|
||||
7 5 xx1 yy2 c5_default
|
||||
7 6 xx1 yy2 c5_default
|
||||
8 7 xx1 yy2 c5_default
|
||||
select * from t1 order by c1 desc, c2 desc;
|
||||
c1 c2 c3 c4 c5
|
||||
8 7 xx1 yy2 c5_default
|
||||
7 6 xx1 yy2 c5_default
|
||||
7 5 xx1 yy2 c5_default
|
||||
5 2 xx yy c5_default
|
||||
5 1 xx yy c5_default
|
||||
3 4 c d c5_default
|
||||
1 2 a b c5_default
|
||||
select * from t1 where c1 + c2 < 10;
|
||||
c1 c2 c3 c4 c5
|
||||
1 2 a b c5_default
|
||||
3 4 c d c5_default
|
||||
5 1 xx yy c5_default
|
||||
5 2 xx yy c5_default
|
||||
select * from t1 limit 2;
|
||||
c1 c2 c3 c4 c5
|
||||
1 2 a b c5_default
|
||||
3 4 c d c5_default
|
||||
select * from t1 where c1 = 5;
|
||||
c1 c2 c3 c4 c5
|
||||
5 1 xx yy c5_default
|
||||
5 2 xx yy c5_default
|
||||
select * from t1 where c1 = 5 or c1 = 7;
|
||||
c1 c2 c3 c4 c5
|
||||
5 1 xx yy c5_default
|
||||
5 2 xx yy c5_default
|
||||
7 5 xx1 yy2 c5_default
|
||||
7 6 xx1 yy2 c5_default
|
||||
select * from t1 where (c1 = 2 and c2 = 4) or (c1 = 7 and c2 = 5) or (c1 = 8 and c2 = 7);
|
||||
c1 c2 c3 c4 c5
|
||||
7 5 xx1 yy2 c5_default
|
||||
8 7 xx1 yy2 c5_default
|
||||
select * from t1 where c2 = 2 and c1 + c2 < 10 and c4 > c3;
|
||||
c1 c2 c3 c4 c5
|
||||
1 2 a b c5_default
|
||||
5 2 xx yy c5_default
|
||||
select c1, c2 from t1 where c2 > 4;
|
||||
c1 c2
|
||||
7 5
|
||||
7 6
|
||||
8 7
|
||||
***** test index back
|
||||
drop table t1;
|
||||
create table t1(c1 int primary key, c2 int, c3 int, index idx(c2));
|
||||
insert into t1 values(1,1,1), (2,2,2), (3,3,3), (4,4,4),(5,5,5), (6,6,6), (7,7,7);
|
||||
|
||||
select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c2 > 1 and c1 < 4;
|
||||
c1 c2 c3
|
||||
2 2 2
|
||||
3 3 3
|
||||
|
||||
select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c2 > 1 and c3 < 4;
|
||||
c1 c2 c3
|
||||
2 2 2
|
||||
3 3 3
|
||||
select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c3 != 1 limit 2;
|
||||
c1 c2 c3
|
||||
2 2 2
|
||||
3 3 3
|
||||
drop table t1;
|
||||
connection syscon;
|
||||
Reference in New Issue
Block a user