Skip to content

Commit

Permalink
[#2034] Improvement (trino-connector): Add datatype , catalog test ca…
Browse files Browse the repository at this point in the history
…ses for the Trino connector (#2036)

### What changes were proposed in this pull request?

Add datatype , catalog test cases for the Trino connector

### Why are the changes needed?

Issue: #2034

### Does this PR introduce _any_ user-facing change?

NO

### How was this patch tested?

TriniQueryIT
  • Loading branch information
diqiu50 authored Feb 5, 2024
1 parent abab416 commit 66d2872
Show file tree
Hide file tree
Showing 21 changed files with 748 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
CREATE SCHEMA "test.gt_hive".gt_db1;

USE "test.gt_hive".gt_db1;

-- Unsupported Type: TIME
CREATE TABLE tb01 (
f1 VARCHAR(200),
f2 CHAR(20),
f3 VARBINARY,
f4 DECIMAL(10, 3),
f5 REAL,
f6 DOUBLE,
f7 BOOLEAN,
f8 TINYINT,
f9 SMALLINT,
f10 INT,
f11 INTEGER,
f12 BIGINT,
f13 DATE,
f15 TIMESTAMP
);

SHOW CREATE TABLE tb01;

INSERT INTO tb01 (f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f15)
VALUES ('Sample text 1', 'Text1', x'65', 123.456, 7.89, 12.34, false, 1, 100, 1000, 1000, 100000, DATE '2024-01-01', TIMESTAMP '2024-01-01 08:00:00');

INSERT INTO tb01 (f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f15)
VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

select * from tb01 order by f1;

drop table tb01;

drop schema "test.gt_hive".gt_db1 cascade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
CREATE SCHEMA

USE

CREATE TABLE

"CREATE TABLE ""test.gt_hive"".gt_db1.tb01 (
f1 varchar(200),
f2 char(20),
f3 varbinary,
f4 decimal(10, 3),
f5 real,
f6 double,
f7 boolean,
f8 tinyint,
f9 smallint,
f10 integer,
f11 integer,
f12 bigint,
f13 date,
f15 timestamp(3)
)
COMMENT ''
WITH (
input_format = 'org.apache.hadoop.mapred.TextInputFormat',
location = 'hdfs://%:9000/user/hive/warehouse/gt_db1.db/tb01',
output_format = 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat',
serde_lib = 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe',
serde_name = 'tb01',
table_type = 'MANAGED_TABLE'
)"

INSERT: 1 row

INSERT: 1 row

"Sample text 1","Text1 ","65","123.456","7.89","12.34","false","1","100","1000","1000","100000","2024-01-01","2024-01-01 08:00:00.000"
"","","","","","","","","","","","","",""

DROP TABLE

DROP SCHEMA
Original file line number Diff line number Diff line change
@@ -1,12 +1,61 @@
CREATE SCHEMA "test.gt_mysql".gt_db1;

SHOW SCHEMAS FROM "test.gt_mysql" like 'gt_db1';

SHOW CREATE SCHEMA "test.gt_mysql".gt_db1;

CREATE SCHEMA "test.gt_mysql".gt_db1;

CREATE SCHEMA IF NOT EXISTS "test.gt_mysql".gt_db1;

CREATE SCHEMA IF NOT EXISTS "test.gt_mysql".gt_db2;

SHOW SCHEMAS FROM "test.gt_mysql" like 'gt_db2';

CREATE TABLE "test.gt_mysql".gt_db1.tb01 (
name varchar(200),
salary int
);

show create table "test.gt_mysql".gt_db1.tb01;
SHOW CREATE TABLE "test.gt_mysql".gt_db1.tb01;

SHOW tables FROM "test.gt_mysql".gt_db1 like 'tb01';

CREATE TABLE "test.gt_mysql".gt_db1.tb01 (
name varchar(200),
salary int
);

CREATE TABLE IF NOT EXISTS "test.gt_mysql".gt_db1.tb01 (
name varchar(200),
salary int
);

CREATE TABLE IF NOT EXISTS "test.gt_mysql".gt_db1.tb02 (
name varchar(200),
salary int
);

SHOW tables FROM "test.gt_mysql".gt_db1 like 'tb02';

DROP TABLE "test.gt_mysql".gt_db1.tb01;

SHOW tables FROM "test.gt_mysql".gt_db1 like 'tb01';

DROP TABLE "test.gt_mysql".gt_db1.tb01;

DROP TABLE IF EXISTS "test.gt_mysql".gt_db1.tb01;

DROP TABLE IF EXISTS "test.gt_mysql".gt_db1.tb02;

SHOW tables FROM "test.gt_mysql".gt_db1 like 'tb02';

DROP SCHEMA "test.gt_mysql".gt_db1;

SHOW SCHEMAS FROM "test.gt_mysql" like 'gt_db1';

DROP SCHEMA IF EXISTS "test.gt_mysql".gt_db1;

drop table "test.gt_mysql".gt_db1.tb01;
DROP SCHEMA IF EXISTS "test.gt_mysql".gt_db2;

drop schema "test.gt_mysql".gt_db1;
SHOW SCHEMAS FROM "test.gt_mysql" like 'gt_db2'
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
CREATE SCHEMA

"gt_db1"

"CREATE SCHEMA ""test.gt_mysql"".gt_db1"

<QUERY_FAILED> Schema 'test.gt_mysql.gt_db1' already exists

CREATE SCHEMA

CREATE SCHEMA

"gt_db2"

CREATE TABLE

"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (
Expand All @@ -11,6 +23,34 @@ WITH (
engine = 'InnoDB'
)"

"tb01"

<QUERY_FAILED> Table 'test.gt_mysql.gt_db1.tb01' already exists

CREATE TABLE

CREATE TABLE

"tb02"

DROP TABLE

<BLANK_LINE>

<QUERY_FAILED> Table 'test.gt_mysql.gt_db1.tb01' does not exist

DROP TABLE

DROP TABLE

<BLANK_LINE>

DROP SCHEMA

<BLANK_LINE>

DROP SCHEMA

DROP SCHEMA

<BLANK_LINE>
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ insert into "test.gt_mysql".gt_db1.tb02(name, salary) select distinct * from "te

select * from "test.gt_mysql".gt_db1.tb02 order by name;

select * from "test.gt_mysql".gt_db1.tb01 join "test.gt_mysql".gt_db1.tb02 t on tb01.salary = t.salary order by tb01.name;

drop table "test.gt_mysql".gt_db1.tb02;

drop table "test.gt_mysql".gt_db1.tb01;

drop schema "test.gt_mysql".gt_db1;
drop schema "test.gt_mysql".gt_db1;
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ INSERT: 4 rows
"sam","11"
"tom","12"

"bob","14","bob","14"
"jerry","13","jerry","13"
"sam","11","sam","11"
"tom","12","tom","12"

DROP TABLE

DROP TABLE

DROP SCHEMA


Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ show create table "test.gt_mysql".gt_db1.tb01;
alter table "test.gt_mysql".gt_db1.tb01 alter column salary set data type bigint;
show create table "test.gt_mysql".gt_db1.tb01;

comment on column "test.gt_mysql".gt_db1.tb01.name is 'test column comments';
show create table "test.gt_mysql".gt_db1.tb01;

comment on table "test.gt_mysql".gt_db1.tb01 is 'test table comments';
show create table "test.gt_mysql".gt_db1.tb01;

alter table "test.gt_mysql".gt_db1.tb01 rename column name to s;
show create table "test.gt_mysql".gt_db1.tb01;

-- alter table "test.gt_mysql".gt_db1.tb01 add column city varchar(50) not null comment 'aaa';
alter table "test.gt_mysql".gt_db1.tb01 add column city varchar(50) comment 'aaa';
show create table "test.gt_mysql".gt_db1.tb01;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,41 +32,74 @@ WITH (
engine = 'InnoDB'
)"

COMMENT

"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (
name varchar(200) COMMENT 'test column comments',
salary bigint
)
COMMENT ''
WITH (
engine = 'InnoDB'
)"

COMMENT

"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (
name varchar(200) COMMENT 'test column comments',
salary bigint
)
COMMENT 'test table comments'
WITH (
engine = 'InnoDB'
)"

RENAME COLUMN

"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (
s varchar(200) COMMENT 'test column comments',
salary bigint
)
COMMENT 'test table comments'
WITH (
engine = 'InnoDB'
)"

ADD COLUMN

"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (
name varchar(200),
s varchar(200) COMMENT 'test column comments',
salary bigint,
city varchar(50) COMMENT 'aaa'
)
COMMENT ''
COMMENT 'test table comments'
WITH (
engine = 'InnoDB'
)"

ADD COLUMN

"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (
name varchar(200),
s varchar(200) COMMENT 'test column comments',
salary bigint,
city varchar(50) COMMENT 'aaa',
age integer NOT NULL COMMENT 'age of users'
)
COMMENT ''
COMMENT 'test table comments'
WITH (
engine = 'InnoDB'
)"

ADD COLUMN

"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (
name varchar(200),
s varchar(200) COMMENT 'test column comments',
salary bigint,
city varchar(50) COMMENT 'aaa',
age integer NOT NULL COMMENT 'age of users',
address varchar(200) NOT NULL COMMENT 'address of users'
)
COMMENT ''
COMMENT 'test table comments'
WITH (
engine = 'InnoDB'
)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ CREATE TABLE tb01 (

show tables from "test.gt_mysql".gt_db1;

show tables;

use tpch.tiny;

show tables;

USE "test.gt_mysql".gt_db1;

show tables;

drop table tb01;

drop schema "test.gt_mysql".gt_db1;

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ CREATE TABLE

"tb01"

"tb01"

USE

"customer"
"lineitem"
"nation"
"orders"
"part"
"partsupp"
"region"
"supplier"

USE

"tb01"

DROP TABLE

DROP SCHEMA
Loading

0 comments on commit 66d2872

Please sign in to comment.