Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expression, tests: move more test cases to integrationtest #47002

Merged
merged 6 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions expression/integration_serial_test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ go_test(
"main_test.go",
],
flaky = True,
shard_count = 17,
shard_count = 14,
deps = [
"//config",
"//expression",
"//parser/mysql",
"//parser/terror",
"//planner/core",
"//session",
Expand Down
1,235 changes: 0 additions & 1,235 deletions expression/integration_serial_test/integration_serial_test.go

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions expression/integration_test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ go_test(
"main_test.go",
],
flaky = True,
shard_count = 50,
shard_count = 41,
deps = [
"//config",
"//domain",
Expand All @@ -31,7 +31,6 @@ go_test(
"//util/codec",
"//util/collate",
"//util/sem",
"//util/sqlexec",
"//util/timeutil",
"//util/versioninfo",
"@com_github_pingcap_errors//:errors",
Expand Down
2,324 changes: 2 additions & 2,322 deletions expression/integration_test/integration_test.go

Large diffs are not rendered by default.

Binary file not shown.
80 changes: 80 additions & 0 deletions tests/integrationtest/r/expression/cast.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
select cast('' as signed);
cast('' as signed)
0
show warnings;
Level Code Message
select cast('12345abcde' as signed);
cast('12345abcde' as signed)
12345
show warnings;
Level Code Message
select cast('123e456' as signed);
cast('123e456' as signed)
123
show warnings;
Level Code Message
select cast('-12345abcde' as signed);
cast('-12345abcde' as signed)
-12345
show warnings;
Level Code Message
select cast('-123e456' as signed);
cast('-123e456' as signed)
-123
show warnings;
Level Code Message
select coercibility(binary('a'));
coercibility(binary('a'))
2
select coercibility(cast('a' as char(10)));
coercibility(cast('a' as char(10)))
2
select coercibility(convert('abc', char(10)));
coercibility(convert('abc', char(10)))
2
drop table if exists t;
create table t(d1 double, f float, d2 decimal(24,8));
insert into t values(0, 0, 0);
select cast(111.1 as datetime) from t;
cast(111.1 as datetime)
2000-01-11 00:00:00
select cast(1311.1 as datetime) from t;
cast(1311.1 as datetime)
NULL
insert into t values(111.1, 1122.1, 31212.111);
insert into t values(121212.1111, 1121212.111111, 11121212.111111);
insert into t values(99991111.1111111, 101.1111111, 20121212121212.1111111);
insert into t values(NULL, NULL, NULL);
insert into t values(1.1, 48.1, 100.1);
insert into t values(1301.11, 1131.111, 100001111.111);
insert into t values(20121212121260.1111111, 20121212126012.1111111, 20121212241212.1111111);
select cast(d1 as datetime), cast(f as datetime), cast(d2 as datetime) from t;
cast(d1 as datetime) cast(f as datetime) cast(d2 as datetime)
NULL NULL NULL
NULL NULL NULL
NULL NULL NULL
NULL NULL NULL
0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
2000-01-11 00:00:00 2000-11-22 00:00:00 2003-12-12 00:00:00
2012-12-12 00:00:00 0112-12-12 00:00:00 1112-12-12 00:00:00
9999-11-11 00:00:00 2000-01-01 00:00:00 2012-12-12 12:12:12
drop table if exists t;
create table t (col1 bigint, col2 double, col3 decimal, col4 varchar(20), col5 json);
insert into t values (1, 1, 1, "1", "1");
insert into t values (null, null, null, null, null);
select cast(col1 as time), cast(col2 as time), cast(col3 as time), cast(col4 as time), cast(col5 as time) from t where col1 = 1;
cast(col1 as time) cast(col2 as time) cast(col3 as time) cast(col4 as time) cast(col5 as time)
00:00:01 00:00:01 00:00:01 00:00:01 NULL
select cast(col1 as time), cast(col2 as time), cast(col3 as time), cast(col4 as time), cast(col5 as time) from t where col1 is null;
cast(col1 as time) cast(col2 as time) cast(col3 as time) cast(col4 as time) cast(col5 as time)
NULL NULL NULL NULL NULL
select cast(col1 as time(31)) from t where col1 is null;
Error 1426: Too big precision 31 specified for column 'CAST'. Maximum is 6.
select cast(col2 as time(31)) from t where col1 is null;
Error 1426: Too big precision 31 specified for column 'CAST'. Maximum is 6.
select cast(col3 as time(31)) from t where col1 is null;
Error 1426: Too big precision 31 specified for column 'CAST'. Maximum is 6.
select cast(col4 as time(31)) from t where col1 is null;
Error 1426: Too big precision 31 specified for column 'CAST'. Maximum is 6.
select cast(col5 as time(31)) from t where col1 is null;
Error 1426: Too big precision 31 specified for column 'CAST'. Maximum is 6.
31 changes: 31 additions & 0 deletions tests/integrationtest/r/expression/issues.result
Original file line number Diff line number Diff line change
Expand Up @@ -2628,3 +2628,34 @@ NULL 0
0 0
0 0
1 1
drop table if exists author_addresses, authors;
CREATE TABLE author_addresses (
id bigint(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE authors (
id bigint(20) NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
author_address_id bigint(20) DEFAULT NULL,
author_address_extra_id bigint(20) DEFAULT NULL,
organization_id varchar(255) DEFAULT NULL,
owned_essay_id varchar(255) DEFAULT NULL,
PRIMARY KEY (id),
KEY index_authors_on_author_address_id (author_address_id),
KEY index_authors_on_author_address_extra_id (author_address_extra_id),
CONSTRAINT fk_rails_94423a17a3 FOREIGN KEY (author_address_id) REFERENCES author_addresses (id) ON UPDATE CASCADE ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
SELECT fk.referenced_table_name AS 'to_table',
fk.referenced_column_name AS 'primary_key',
fk.column_name AS 'column',
fk.constraint_name AS 'name',
rc.update_rule AS 'on_update',
rc.delete_rule AS 'on_delete'
FROM information_schema.referential_constraints rc
JOIN information_schema.key_column_usage fk
USING (constraint_schema, constraint_name)
WHERE fk.referenced_column_name IS NOT NULL
AND fk.table_schema = database()
AND fk.table_name = 'authors';
to_table primary_key column name on_update on_delete
author_addresses id author_address_id fk_rails_94423a17a3 CASCADE RESTRICT
Loading