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

[#4779] Improvement(trino-connector): Add the testset for the Iceberg catalog with jdbc backend #4780

Merged
merged 3 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion integration-test-common/docker-script/init/trino/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ cp "$trino_conf_dir/config/jvm.config" /etc/trino/jvm.config
cp "$trino_conf_dir/config/log4j2.properties" /etc/trino/log4j2.properties
cp "$trino_conf_dir/config/catalog/gravitino.properties" /etc/trino/catalog/gravitino.properties

#
# Copy the MYSQL driver to iceberg connector
cp /usr/lib/trino/plugin/mysql/mysql-connector-j-8.2.0.jar /usr/lib/trino/plugin/iceberg/

# Update `gravitino.uri = http://GRAVITINO_HOST_IP:GRAVITINO_HOST_PORT` in the `conf/catalog/gravitino.properties`
sed -i "s/GRAVITINO_HOST_IP:GRAVITINO_HOST_PORT/${GRAVITINO_HOST_IP}:${GRAVITINO_HOST_PORT}/g" /etc/trino/catalog/gravitino.properties
# Update `gravitino.metalake = GRAVITINO_METALAKE_NAME` in the `conf/catalog/gravitino.properties`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,16 @@ public static void main(String[] args) throws Exception {
TrinoQueryIT.ciTestsets.clear();

String testHost = commandLine.getOptionValue("test_host");
TrinoQueryIT.testHost = Strings.isBlank(testHost) ? TrinoQueryIT.testHost : testHost;
if (Strings.isNotEmpty(testHost)) {
TrinoQueryIT.testHost = testHost;
TrinoQueryIT.gravitinoUri = String.format("http://%s:8090", testHost);
TrinoQueryIT.trinoUri = String.format("http://%s:8080", testHost);
TrinoQueryIT.hiveMetastoreUri = String.format("thrift://%s:9083", testHost);
TrinoQueryIT.hdfsUri = String.format("hdfs://%s:9000", testHost);
TrinoQueryIT.mysqlUri = String.format("jdbc:mysql://%s", testHost);
TrinoQueryIT.postgresqlUri = String.format("jdbc:postgresql://%s", testHost);
}

String gravitinoUri = commandLine.getOptionValue("gravitino_uri");
TrinoQueryIT.gravitinoUri =
Strings.isBlank(gravitinoUri) ? TrinoQueryIT.gravitinoUri : gravitinoUri;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
CREATE SCHEMA gt_iceberg.gt_db2;
CREATE SCHEMA gt_db2;

CREATE TABLE gt_iceberg.gt_db2.tb01(
CREATE TABLE gt_db2.tb01(
name varchar,
salary int
);

show create table gt_iceberg.gt_db2.tb01;
show create table gt_db2.tb01;

CREATE TABLE gt_iceberg.gt_db2.tb02 (
CREATE TABLE gt_db2.tb02 (
name varchar,
salary int
) with (
partitioning = ARRAY['name'],
sorted_by = ARRAY['salary']
);

show create table gt_iceberg.gt_db2.tb02;
show create table gt_db2.tb02;

CREATE TABLE gt_iceberg.gt_db2.tb03 (
CREATE TABLE gt_db2.tb03 (
name varchar,
salary int
) with (
partitioning = ARRAY['name'],
sorted_by = ARRAY['salary_wrong_name']
);

CREATE TABLE gt_iceberg.gt_db2.tb03 (
CREATE TABLE gt_db2.tb03 (
name varchar,
salary int
) with (
partitioning = ARRAY['name'],
sorted_by = ARRAY['name']
);

show create table gt_iceberg.gt_db2.tb03;
show create table gt_db2.tb03;


CREATE TABLE gt_iceberg.gt_db2.tb04 (
CREATE TABLE gt_db2.tb04 (
name varchar,
salary int
) with (
sorted_by = ARRAY['name']
);

show create table gt_iceberg.gt_db2.tb04;
show create table gt_db2.tb04;

CREATE TABLE gt_iceberg.gt_db2.tb05 (
CREATE TABLE gt_db2.tb05 (
name varchar,
salary int
) with (
partitioning = ARRAY['name']
);

show create table gt_iceberg.gt_db2.tb05;
show create table gt_db2.tb05;

CREATE TABLE gt_iceberg.gt_db2.tb06 (
CREATE TABLE gt_db2.tb06 (
name varchar,
salary int
) with (
location = '${hdfs_uri}/user/iceberg/warehouse/TrinoQueryIT/gt_iceberg/gt_db2/tb06'
);

show create table gt_iceberg.gt_db2.tb06;
show create table gt_db2.tb06;

drop table gt_iceberg.gt_db2.tb01;
drop table gt_db2.tb01;

drop table gt_iceberg.gt_db2.tb02;
drop table gt_db2.tb02;

drop table gt_iceberg.gt_db2.tb03;
drop table gt_db2.tb03;

drop table gt_iceberg.gt_db2.tb04;
drop table gt_db2.tb04;

drop table gt_iceberg.gt_db2.tb05;
drop table gt_db2.tb05;

drop table gt_iceberg.gt_db2.tb06;
drop table gt_db2.tb06;

drop schema gt_iceberg.gt_db2;
drop schema gt_db2;
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ CREATE SCHEMA

CREATE TABLE

"CREATE TABLE gt_iceberg.gt_db2.tb01 (
"CREATE TABLE %.gt_db2.tb01 (
name varchar,
salary integer
)
COMMENT ''
WITH (
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2.db/tb01'
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2%/tb01'
)"

CREATE TABLE

"CREATE TABLE gt_iceberg.gt_db2.tb02 (
"CREATE TABLE %.gt_db2.tb02 (
name varchar,
salary integer
)
COMMENT ''
WITH (
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2.db/tb02',
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2%/tb02',
partitioning = ARRAY['name'],
sorted_by = ARRAY['salary']
)"
Expand All @@ -28,50 +28,50 @@ WITH (

CREATE TABLE

"CREATE TABLE gt_iceberg.gt_db2.tb03 (
"CREATE TABLE %.gt_db2.tb03 (
name varchar,
salary integer
)
COMMENT ''
WITH (
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2.db/tb03',
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2%/tb03',
partitioning = ARRAY['name'],
sorted_by = ARRAY['name']
)"

CREATE TABLE

"CREATE TABLE gt_iceberg.gt_db2.tb04 (
"CREATE TABLE %.gt_db2.tb04 (
name varchar,
salary integer
)
COMMENT ''
WITH (
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2.db/tb04',
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2%/tb04',
sorted_by = ARRAY['name']
)"

CREATE TABLE

"CREATE TABLE gt_iceberg.gt_db2.tb05 (
"CREATE TABLE %.gt_db2.tb05 (
name varchar,
salary integer
)
COMMENT ''
WITH (
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2.db/tb05',
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2%/tb05',
partitioning = ARRAY['name']
)"

CREATE TABLE

"CREATE TABLE gt_iceberg.gt_db2.tb06 (
"CREATE TABLE %.gt_db2.tb06 (
name varchar,
salary integer
)
COMMENT ''
WITH (
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_iceberg/gt_db2/tb06'
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/%/gt_db2/tb06'
)"

DROP TABLE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
CREATE SCHEMA gt_iceberg.gt_db2;
CREATE SCHEMA gt_db2;

CREATE TABLE gt_iceberg.gt_db2.tb01 (
CREATE TABLE gt_db2.tb01 (
name varchar,
salary int
);


insert into gt_iceberg.gt_db2.tb01(name, salary) values ('sam', 11);
insert into gt_iceberg.gt_db2.tb01(name, salary) values ('jerry', 13);
insert into gt_iceberg.gt_db2.tb01(name, salary) values ('bob', 14), ('tom', 12);
insert into gt_db2.tb01(name, salary) values ('sam', 11);
insert into gt_db2.tb01(name, salary) values ('jerry', 13);
insert into gt_db2.tb01(name, salary) values ('bob', 14), ('tom', 12);

select * from gt_iceberg.gt_db2.tb01 order by name;
select * from gt_db2.tb01 order by name;

CREATE TABLE gt_iceberg.gt_db2.tb02 (
CREATE TABLE gt_db2.tb02 (
name varchar,
salary int
);

insert into gt_iceberg.gt_db2.tb02(name, salary) select * from gt_iceberg.gt_db2.tb01 order by name;
insert into gt_db2.tb02(name, salary) select * from gt_db2.tb01 order by name;

select * from gt_iceberg.gt_db2.tb02 order by name;
select * from gt_db2.tb02 order by name;

drop table gt_iceberg.gt_db2.tb02;
drop table gt_db2.tb02;

drop table gt_iceberg.gt_db2.tb01;
drop table gt_db2.tb01;

drop schema gt_iceberg.gt_db2;
drop schema gt_db2;
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
CREATE SCHEMA gt_iceberg.gt_db2;
CREATE SCHEMA gt_db2;

CREATE TABLE gt_iceberg.gt_db2.tb01 (
CREATE TABLE gt_db2.tb01 (
name varchar,
salary int,
city int
);

alter table gt_iceberg.gt_db2.tb01 rename to gt_iceberg.gt_db2.tb03;
show tables from gt_iceberg.gt_db2;
alter table gt_db2.tb01 rename to gt_db2.tb03;
show tables from gt_db2;

alter table gt_iceberg.gt_db2.tb03 rename to gt_iceberg.gt_db2.tb01;
show tables from gt_iceberg.gt_db2;
alter table gt_db2.tb03 rename to gt_db2.tb01;
show tables from gt_db2;

alter table gt_iceberg.gt_db2.tb01 drop column city;
show create table gt_iceberg.gt_db2.tb01;
alter table gt_db2.tb01 drop column city;
show create table gt_db2.tb01;

alter table gt_iceberg.gt_db2.tb01 rename column name to s;
show create table gt_iceberg.gt_db2.tb01;
alter table gt_db2.tb01 rename column name to s;
show create table gt_db2.tb01;

alter table gt_iceberg.gt_db2.tb01 alter column salary set data type bigint;
show create table gt_iceberg.gt_db2.tb01;
alter table gt_db2.tb01 alter column salary set data type bigint;
show create table gt_db2.tb01;

comment on table gt_iceberg.gt_db2.tb01 is 'test table comments';
show create table gt_iceberg.gt_db2.tb01;
comment on table gt_db2.tb01 is 'test table comments';
show create table gt_db2.tb01;

comment on column gt_iceberg.gt_db2.tb01.s is 'test column comments';
show create table gt_iceberg.gt_db2.tb01;
comment on column gt_db2.tb01.s is 'test column comments';
show create table gt_db2.tb01;

alter table gt_iceberg.gt_db2.tb01 add column city varchar comment 'aaa';
show create table gt_iceberg.gt_db2.tb01;
alter table gt_db2.tb01 add column city varchar comment 'aaa';
show create table gt_db2.tb01;

drop table gt_iceberg.gt_db2.tb01;
drop table gt_db2.tb01;

drop schema gt_iceberg.gt_db2;
drop schema gt_db2;
Original file line number Diff line number Diff line change
Expand Up @@ -12,69 +12,69 @@ RENAME TABLE

DROP COLUMN

"CREATE TABLE gt_iceberg.gt_db2.tb01 (
"CREATE TABLE %.gt_db2.tb01 (
name varchar,
salary integer
)
COMMENT ''
WITH (
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2.db/tb01'
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2%/tb01'
)"

RENAME COLUMN

"CREATE TABLE gt_iceberg.gt_db2.tb01 (
"CREATE TABLE %.gt_db2.tb01 (
s varchar,
salary integer
)
COMMENT ''
WITH (
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2.db/tb01'
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2%/tb01'
)"

SET COLUMN TYPE

"CREATE TABLE gt_iceberg.gt_db2.tb01 (
"CREATE TABLE %.gt_db2.tb01 (
s varchar,
salary bigint
)
COMMENT ''
WITH (
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2.db/tb01'
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2%/tb01'
)"

COMMENT

"CREATE TABLE gt_iceberg.gt_db2.tb01 (
"CREATE TABLE %.gt_db2.tb01 (
s varchar,
salary bigint
)
COMMENT 'test table comments'
WITH (
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2.db/tb01'
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2%/tb01'
)"

COMMENT

"CREATE TABLE gt_iceberg.gt_db2.tb01 (
"CREATE TABLE %.gt_db2.tb01 (
s varchar COMMENT 'test column comments',
salary bigint
)
COMMENT 'test table comments'
WITH (
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2.db/tb01'
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2%/tb01'
)"

ADD COLUMN

"CREATE TABLE gt_iceberg.gt_db2.tb01 (
"CREATE TABLE %.gt_db2.tb01 (
s varchar COMMENT 'test column comments',
salary bigint,
city varchar COMMENT 'aaa'
)
COMMENT 'test table comments'
WITH (
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2.db/tb01'
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2%/tb01'
)"

DROP TABLE
Expand Down
Loading
Loading