World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#2948] Improve(trino-connector): Update all the testers for using simple catalog name (#3004)
Yuhuibb4d18328ed6
diff --git a/docs/trino-connector/configuration.md b/docs/trino-connector/configuration.mdindex 5b1065abe7..cd1e4c6684 100644--- a/docs/trino-connector/configuration.md+++ b/docs/trino-connector/configuration.md@@ -11,4 +11,4 @@ This software is licensed under the Apache License version 2."| connector.name | string | (none) | The `connector.name` defines the name of Trino connector, this value is always 'gravitino'. | Yes | 0.2.0 || gravitino.metalake | string | (none) | The `gravitino.metalake` defines which metalake in Gravitino server the Trino connector uses. Trino connector should set it at start, the value of `gravitino.metalake` needs to be a valid name, Trino connector can detect and load the metalake with catalogs, schemas and tables once created and keep in sync. | Yes | 0.2.0 || gravitino.uri | string | http://localhost:8090 | The `gravitino.uri` defines the connection URL of the Gravitino server, the default value is `http://localhost:8090`. Trino connector can detect and connect to Gravitino server once it is ready, no need to start Gravitino server beforehand. | Yes | 0.2.0 |-| gravitino.simplify-catalog-names | boolean | false | The `gravitino.simplify-catalog-names` setting omits the metalake prefix from catalog names when set to true. If you set it to true, Trino will configure only one Graviton catalog. | NO | 0.5.0 |+| gravitino.simplify-catalog-names | boolean | true | The `gravitino.simplify-catalog-names` setting omits the metalake prefix from catalog names when set to true. If you set it to true, Trino will configure only one Graviton catalog. | NO | 0.5.0 |diff --git a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/trino/TrinoConnectorIT.java b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/trino/TrinoConnectorIT.javaindex 0067763c4b..1f8c90ce76 100644--- a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/trino/TrinoConnectorIT.java+++ b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/trino/TrinoConnectorIT.java@@ -131,10 +131,9 @@ public class TrinoConnectorIT extends AbstractIT {public static void createSchema() throws TException, InterruptedException {String sql1 =String.format(- "CREATE SCHEMA \"%s.%s\".%s WITH (\n"+ "CREATE SCHEMA %s.%s WITH (\n"+ " location = 'hdfs://%s:%d/user/hive/warehouse/%s.db'\n"+ ")",- metalakeName,catalogName,databaseName,containerSuite.getHiveContainer().getContainerIpAddress(),@@ -149,17 +148,13 @@ public class TrinoConnectorIT extends AbstractIT {containerSuite.getTrinoContainer().executeQuerySQL(- String.format(- "show schemas from \"%s.%s\" like '%s'",- metalakeName, catalogName, databaseName));+ String.format("show schemas from %s like '%s'", catalogName, databaseName));Assertions.assertEquals(r.get(0).get(0), databaseName);}@Testpublic void testShowSchemas() {- String sql =- String.format(- "SHOW SCHEMAS FROM \"%s.%s\" LIKE '%s'", metalakeName, catalogName, databaseName);+ String sql = String.format("SHOW SCHEMAS FROM %s LIKE '%s'", catalogName, databaseName);ArrayList<ArrayList<String>> queryData =containerSuite.getTrinoContainer().executeQuerySQL(sql);Assertions.assertEquals(queryData.get(0).get(0), databaseName);@@ -169,7 +164,7 @@ public class TrinoConnectorIT extends AbstractIT {public void testCreateTable() throws TException, InterruptedException {String sql3 =String.format(- "CREATE TABLE \"%s.%s\".%s.%s (\n"+ "CREATE TABLE %s.%s.%s (\n"+ " col1 varchar,\n"+ " col2 varchar,\n"+ " col3 varchar\n"@@ -177,7 +172,7 @@ public class TrinoConnectorIT extends AbstractIT {+ "WITH (\n"+ " format = 'TEXTFILE'\n"+ ")",- metalakeName, catalogName, databaseName, tab1Name);+ catalogName, databaseName, tab1Name);containerSuite.getTrinoContainer().executeUpdateSQL(sql3);// Verify in Gravitino Server@@ -192,9 +187,7 @@ public class TrinoConnectorIT extends AbstractIT {private void testShowTable() {String sql =- String.format(- "SHOW TABLES FROM \"%s.%s\".%s LIKE '%s'",- metalakeName, catalogName, databaseName, tab1Name);+ String.format("SHOW TABLES FROM %s.%s LIKE '%s'", catalogName, databaseName, tab1Name);ArrayList<ArrayList<String>> queryData =containerSuite.getTrinoContainer().executeQuerySQL(sql);Assertions.assertEquals(queryData.get(0).get(0), tab1Name);@@ -205,9 +198,7 @@ public class TrinoConnectorIT extends AbstractIT {ArrayList<ArrayList<String>> r =containerSuite.getTrinoContainer()- .executeQuerySQL(- String.format(- "show schemas from \"%s.%s\" like '%s'", metalakeName, catalogName, dbName));+ .executeQuerySQL(String.format("show schemas from %s like '%s'", catalogName, dbName));Assertions.assertEquals(r.get(0).get(0), dbName);// Compare table@@ -215,16 +206,14 @@ public class TrinoConnectorIT extends AbstractIT {containerSuite.getTrinoContainer().executeQuerySQL(- String.format(- "show create table \"%s.%s\".%s.%s",- metalakeName, catalogName, dbName, tableName));+ String.format("show create table %s.%s.%s", catalogName, dbName, tableName));Assertions.assertTrue(r.get(0).get(0).contains(tableName));}public void testScenarioTable1() throws TException, InterruptedException {String sql3 =String.format(- "CREATE TABLE \"%s.%s\".%s.%s (\n"+ "CREATE TABLE %s.%s.%s (\n"+ " user_name varchar,\n"+ " gender varchar,\n"+ " age varchar,\n"@@ -238,7 +227,7 @@ public class TrinoConnectorIT extends AbstractIT {+ "WITH (\n"+ " format = 'TEXTFILE'\n"+ ")",- metalakeName, catalogName, databaseName, scenarioTab1Name);+ catalogName, databaseName, scenarioTab1Name);containerSuite.getTrinoContainer().executeUpdateSQL(sql3);// Verify in Gravitino Server@@ -258,8 +247,8 @@ public class TrinoConnectorIT extends AbstractIT {StringBuilder sql5 =new StringBuilder(String.format(- "INSERT INTO \"%s.%s\".%s.%s (user_name, gender, age, phone) VALUES",- metalakeName, catalogName, databaseName, scenarioTab1Name));+ "INSERT INTO %s.%s.%s (user_name, gender, age, phone) VALUES",+ catalogName, databaseName, scenarioTab1Name));int index = 0;for (ArrayList<String> record : table1Data) {sql5.append(@@ -276,8 +265,8 @@ public class TrinoConnectorIT extends AbstractIT {// Select data from table1 and verify itString sql6 =String.format(- "SELECT user_name, gender, age, phone FROM \"%s.%s\".%s.%s ORDER BY user_name",- metalakeName, catalogName, databaseName, scenarioTab1Name);+ "SELECT user_name, gender, age, phone FROM %s.%s.%s ORDER BY user_name",+ catalogName, databaseName, scenarioTab1Name);ArrayList<ArrayList<String>> table1QueryData =containerSuite.getTrinoContainer().executeQuerySQL(sql6);Assertions.assertEquals(table1Data, table1QueryData);@@ -286,7 +275,7 @@ public class TrinoConnectorIT extends AbstractIT {public void testScenarioTable2() throws TException, InterruptedException {String sql4 =String.format(- "CREATE TABLE \"%s.%s\".%s.%s (\n"+ "CREATE TABLE %s.%s.%s (\n"+ " user_name varchar,\n"+ " consumer varchar,\n"+ " recharge varchar,\n"@@ -297,7 +286,7 @@ public class TrinoConnectorIT extends AbstractIT {+ "WITH (\n"+ " format = 'TEXTFILE'\n"+ ")",- metalakeName, catalogName, databaseName, scenarioTab2Name);+ catalogName, databaseName, scenarioTab2Name);containerSuite.getTrinoContainer().executeUpdateSQL(sql4);// Verify in Gravitino Server@@ -318,8 +307,8 @@ public class TrinoConnectorIT extends AbstractIT {StringBuilder sql7 =new StringBuilder(String.format(- "INSERT INTO \"%s.%s\".%s.%s (user_name, consumer, recharge, event_time) VALUES",- metalakeName, catalogName, databaseName, scenarioTab2Name));+ "INSERT INTO %s.%s.%s (user_name, consumer, recharge, event_time) VALUES",+ catalogName, databaseName, scenarioTab2Name));for (ArrayList<String> record : table2Data) {sql7.append(String.format(@@ -335,8 +324,8 @@ public class TrinoConnectorIT extends AbstractIT {// Select data from table1 and verify itString sql8 =String.format(- "SELECT user_name, consumer, recharge, event_time FROM \"%s.%s\".%s.%s ORDER BY user_name",- metalakeName, catalogName, databaseName, scenarioTab2Name);+ "SELECT user_name, consumer, recharge, event_time FROM %s.%s.%s ORDER BY user_name",+ catalogName, databaseName, scenarioTab2Name);ArrayList<ArrayList<String>> table2QueryData =containerSuite.getTrinoContainer().executeQuerySQL(sql8);Assertions.assertEquals(table2Data, table2QueryData);@@ -349,11 +338,11 @@ public class TrinoConnectorIT extends AbstractIT {String sql9 =String.format(- "SELECT * FROM (SELECT t1.user_name as user_name, gender, age, phone, consumer, recharge, event_time FROM \"%1$s.%2$s\".%3$s.%4$s AS t1\n"+ "SELECT * FROM (SELECT t1.user_name as user_name, gender, age, phone, consumer, recharge, event_time FROM %1s.%2$s.%3$s AS t1\n"+ "JOIN\n"- + " (SELECT user_name, consumer, recharge, event_time FROM \"%1$s.%2$s\".%3$s.%5$s) AS t2\n"+ + " (SELECT user_name, consumer, recharge, event_time FROM %1$s.%2$s.%4$s) AS t2\n"+ " ON t1.user_name = t2.user_name) ORDER BY user_name",- metalakeName, catalogName, databaseName, scenarioTab1Name, scenarioTab2Name);+ catalogName, databaseName, scenarioTab1Name, scenarioTab2Name);ArrayList<ArrayList<String>> joinQueryData =containerSuite.getTrinoContainer().executeQuerySQL(sql9);ArrayList<ArrayList<String>> joinData = new ArrayList<>();@@ -379,8 +368,8 @@ public class TrinoConnectorIT extends AbstractIT {String createSchemaSql =String.format(- "CREATE SCHEMA \"%s.%s\".%s with( location = 'hdfs://localhost:9000/user/hive/warehouse/hive_schema_1123123')",- metalakeName, catalogName, schemaName);+ "CREATE SCHEMA %s.%s with( location = 'hdfs://localhost:9000/user/hive/warehouse/hive_schema_1123123')",+ catalogName, schemaName);containerSuite.getTrinoContainer().executeUpdateSQL(createSchemaSql);Schema schema =@@ -395,17 +384,16 @@ public class TrinoConnectorIT extends AbstractIT {String schemaName = GravitinoITUtils.genRandomName("schema").toLowerCase();String tableName = GravitinoITUtils.genRandomName("table").toLowerCase();- String createSchemaSql =- String.format("CREATE SCHEMA \"%s.%s\".%s", metalakeName, catalogName, schemaName);+ String createSchemaSql = String.format("CREATE SCHEMA %s.%s", catalogName, schemaName);containerSuite.getTrinoContainer().executeUpdateSQL(createSchemaSql);String createTableSql =String.format(- "CREATE TABLE \"%s.%s\".%s.%s (id int, name varchar)"+ "CREATE TABLE %s.%s.%s (id int, name varchar)"+ " with ( serde_name = '123455', location = 'hdfs://localhost:9000/user/hive/warehouse/hive_schema.db/hive_table'"+ ", partitioned_by = ARRAY['name'], bucketed_by = ARRAY['id'], bucket_count = 50, sorted_by = ARRAY['name']"+ ")",- metalakeName, catalogName, schemaName, tableName);+ catalogName, schemaName, tableName);containerSuite.getTrinoContainer().executeUpdateSQL(createTableSql);Table table =@@ -473,8 +461,7 @@ public class TrinoConnectorIT extends AbstractIT {.put("location", "hdfs://localhost:9000/user/hive/warehouse/hive_schema_1223445.db").build());- String sql =- String.format("show create schema \"%s.%s\".%s", metalakeName, catalogName, schemaName);+ String sql = String.format("show create schema %s.%s", catalogName, schemaName);boolean success = checkTrinoHasLoaded(sql, 30);if (!success) {Assertions.fail("Trino fail to load schema created by gravitino: " + sql);@@ -623,27 +610,25 @@ public class TrinoConnectorIT extends AbstractIT {.put("jdbc-url", String.format("jdbc:mysql://%s:3306?useSSL=false", hiveHost)).build());- String sql = String.format("show catalogs like '%s.%s'", metalakeName, catalogName);+ String sql = String.format("show catalogs like '%s'", catalogName);Assertions.assertTrue(checkTrinoHasLoaded(sql, 30));String schemaName = GravitinoITUtils.genRandomName("schema").toLowerCase();String tableName = GravitinoITUtils.genRandomName("table").toLowerCase();- String createSchemaSql =- String.format("CREATE SCHEMA \"%s.%s\".%s", metalakeName, catalogName, schemaName);+ String createSchemaSql = String.format("CREATE SCHEMA %s.%s", catalogName, schemaName);containerSuite.getTrinoContainer().executeUpdateSQL(createSchemaSql);- sql = String.format("show create schema \"%s.%s\".%s", metalakeName, catalogName, schemaName);+ sql = String.format("show create schema %s.%s", catalogName, schemaName);Assertions.assertTrue(checkTrinoHasLoaded(sql, 30));String createTableSql =String.format(- "CREATE TABLE \"%s.%s\".%s.%s (id int not null, name varchar not null)",- metalakeName, catalogName, schemaName, tableName);+ "CREATE TABLE %s.%s.%s (id int not null, name varchar not null)",+ catalogName, schemaName, tableName);containerSuite.getTrinoContainer().executeUpdateSQL(createTableSql);String showCreateTableSql =- String.format(- "show create table \"%s.%s\".%s.%s", metalakeName, catalogName, schemaName, tableName);+ String.format("show create table %s.%s.%s", catalogName, schemaName, tableName);ArrayList<ArrayList<String>> rs =containerSuite.getTrinoContainer().executeQuerySQL(showCreateTableSql);Assertions.assertTrue(rs.get(0).get(0).toLowerCase(Locale.ENGLISH).contains("not null"));@@ -652,8 +637,7 @@ public class TrinoConnectorIT extends AbstractIT {.getTrinoContainer().executeUpdateSQL(String.format(- "insert into \"%s.%s\".%s.%s values(1, 'a')",- metalakeName, catalogName, schemaName, tableName));+ "insert into %s.%s.%s values(1, 'a')", catalogName, schemaName, tableName));Assertions.assertThrows(RuntimeException.class,() ->@@ -661,8 +645,8 @@ public class TrinoConnectorIT extends AbstractIT {.getTrinoContainer().executeUpdateSQL(String.format(- "insert into \"%s.%s\".%s.%s values(null, 'a')",- metalakeName, catalogName, schemaName, tableName)));+ "insert into %s.%s.%s values(null, 'a')",+ catalogName, schemaName, tableName)));Assertions.assertThrows(RuntimeException.class,() ->@@ -670,8 +654,8 @@ public class TrinoConnectorIT extends AbstractIT {.getTrinoContainer().executeUpdateSQL(String.format(- "insert into \"%s.%s\".%s.%s values(1, null)",- metalakeName, catalogName, schemaName, tableName)));+ "insert into %s.%s.%s values(1, null)",+ catalogName, schemaName, tableName)));Assertions.assertThrows(RuntimeException.class,() ->@@ -679,8 +663,8 @@ public class TrinoConnectorIT extends AbstractIT {.getTrinoContainer().executeUpdateSQL(String.format(- "insert into \"%s.%s\".%s.%s values(null, null)",- metalakeName, catalogName, schemaName, tableName)));+ "insert into %s.%s.%s values(null, null)",+ catalogName, schemaName, tableName)));catalog.asTableCatalog()@@ -749,9 +733,7 @@ public class TrinoConnectorIT extends AbstractIT {.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));Assertions.assertNotNull(table);- String sql =- String.format(- "show create table \"%s.%s\".%s.%s", metalakeName, catalogName, schemaName, tableName);+ String sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName);boolean success = checkTrinoHasLoaded(sql, 30);if (!success) {Assertions.fail("Trino fail to load table created by gravitino: " + sql);@@ -777,13 +759,11 @@ public class TrinoConnectorIT extends AbstractIT {tableName = GravitinoITUtils.genRandomName("table_format1").toLowerCase();sql =String.format(- "CREATE TABLE \"%s.%s\".%s.%s (id int, name varchar) with (format = 'ORC')",- metalakeName, catalogName, schemaName, tableName);+ "CREATE TABLE %s.%s.%s (id int, name varchar) with (format = 'ORC')",+ catalogName, schemaName, tableName);containerSuite.getTrinoContainer().executeUpdateSQL(sql);- sql =- String.format(- "show create table \"%s.%s\".%s.%s", metalakeName, catalogName, schemaName, tableName);+ sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName);Assertions.assertTrue(checkTrinoHasLoaded(sql, 30), "Trino fail to create table:" + tableName);data = containerSuite.getTrinoContainer().executeQuerySQL(sql).get(0).get(0);@@ -797,12 +777,10 @@ public class TrinoConnectorIT extends AbstractIT {tableName = GravitinoITUtils.genRandomName("table_format2").toLowerCase();sql =String.format(- "CREATE TABLE \"%s.%s\".%s.%s (id int, name varchar) with (format = 'ORC', input_format = 'org.apache.hadoop.mapred.TextInputFormat')",- metalakeName, catalogName, schemaName, tableName);+ "CREATE TABLE %s.%s.%s (id int, name varchar) with (format = 'ORC', input_format = 'org.apache.hadoop.mapred.TextInputFormat')",+ catalogName, schemaName, tableName);containerSuite.getTrinoContainer().executeUpdateSQL(sql);- sql =- String.format(- "show create table \"%s.%s\".%s.%s", metalakeName, catalogName, schemaName, tableName);+ sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName);Assertions.assertTrue(checkTrinoHasLoaded(sql, 30), "Trino fail to create table:" + tableName);data = containerSuite.getTrinoContainer().executeQuerySQL(sql).get(0).get(0);@@ -816,12 +794,10 @@ public class TrinoConnectorIT extends AbstractIT {tableName = GravitinoITUtils.genRandomName("table_format3").toLowerCase();sql =String.format(- "CREATE TABLE \"%s.%s\".%s.%s (id int, name varchar) with (format = 'ORC', output_format = 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat')",- metalakeName, catalogName, schemaName, tableName);+ "CREATE TABLE %s.%s.%s (id int, name varchar) with (format = 'ORC', output_format = 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat')",+ catalogName, schemaName, tableName);containerSuite.getTrinoContainer().executeUpdateSQL(sql);- sql =- String.format(- "show create table \"%s.%s\".%s.%s", metalakeName, catalogName, schemaName, tableName);+ sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName);Assertions.assertTrue(checkTrinoHasLoaded(sql, 30), "Trino fail to create table:" + tableName);data = containerSuite.getTrinoContainer().executeQuerySQL(sql).get(0).get(0);@@ -860,7 +836,7 @@ public class TrinoConnectorIT extends AbstractIT {Assertions.assertEquals("true", catalog.properties().get("hive.create-empty-bucket-files"));Assertions.assertEquals("true", catalog.properties().get("hive.validate-bucketing"));- String sql = String.format("show catalogs like '%s.%s'", metalakeName, catalogName);+ String sql = String.format("show catalogs like '%s'", catalogName);boolean success = checkTrinoHasLoaded(sql, 30);if (!success) {Assertions.fail("Trino fail to load catalogs created by gravitino: " + sql);@@ -868,7 +844,7 @@ public class TrinoConnectorIT extends AbstractIT {// Because we assign 'hive.target-max-file-size' a wrong value, trino can't load the catalogString data = containerSuite.getTrinoContainer().executeQuerySQL(sql).get(0).get(0);- Assertions.assertEquals(metalakeName + "." + catalogName, data);+ Assertions.assertEquals(catalogName, data);}@Test@@ -899,7 +875,7 @@ public class TrinoConnectorIT extends AbstractIT {Assertions.assertEquals("true", catalog.properties().get("hive.create-empty-bucket-files"));Assertions.assertEquals("true", catalog.properties().get("hive.validate-bucketing"));- String sql = String.format("show catalogs like '%s.%s'", metalakeName, catalogName);+ String sql = String.format("show catalogs like '%s'", catalogName);checkTrinoHasLoaded(sql, 6);// Because we assign 'hive.target-max-file-size' a wrong value, trino can't load the catalogAssertions.assertTrue(containerSuite.getTrinoContainer().executeQuerySQL(sql).isEmpty());@@ -966,9 +942,7 @@ public class TrinoConnectorIT extends AbstractIT {.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));Assertions.assertNotNull(table);- String sql =- String.format(- "show create table \"%s.%s\".%s.%s", metalakeName, catalogName, schemaName, tableName);+ String sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName);boolean success = checkTrinoHasLoaded(sql, 30);if (!success) {@@ -985,8 +959,8 @@ public class TrinoConnectorIT extends AbstractIT {String tableCreatedByTrino = GravitinoITUtils.genRandomName("table").toLowerCase();String createTableSql =String.format(- "CREATE TABLE \"%s.%s\".%s.%s (id int, name varchar) with (partitioning = ARRAY['name'], sorted_by = ARRAY['id'])",- metalakeName, catalogName, schemaName, tableCreatedByTrino);+ "CREATE TABLE %s.%s.%s (id int, name varchar) with (partitioning = ARRAY['name'], sorted_by = ARRAY['id'])",+ catalogName, schemaName, tableCreatedByTrino);containerSuite.getTrinoContainer().executeUpdateSQL(createTableSql);table =@@ -1007,14 +981,12 @@ public class TrinoConnectorIT extends AbstractIT {String schemaName = GravitinoITUtils.genRandomName("schema").toLowerCase();String tableName = GravitinoITUtils.genRandomName("table").toLowerCase();- String createSchemaSql =- String.format("CREATE SCHEMA \"%s.%s\".%s", metalakeName, catalogName, schemaName);+ String createSchemaSql = String.format("CREATE SCHEMA %s.%s", catalogName, schemaName);containerSuite.getTrinoContainer().executeUpdateSQL(createSchemaSql);String createTableSql =String.format(- "CREATE TABLE \"%s.%s\".%s.%s (id int, name varchar)",- metalakeName, catalogName, schemaName, tableName);+ "CREATE TABLE %s.%s.%s (id int, name varchar)", catalogName, schemaName, tableName);containerSuite.getTrinoContainer().executeUpdateSQL(createTableSql);Table table =@@ -1061,14 +1033,14 @@ public class TrinoConnectorIT extends AbstractIT {Catalog catalog = createdMetalake.loadCatalog(NameIdentifier.of(metalakeName, catalogName));Assertions.assertEquals("root", catalog.properties().get("jdbc-user"));- String sql = String.format("show catalogs like '%s.%s'", metalakeName, catalogName);+ String sql = String.format("show catalogs like '%s'", catalogName);boolean success = checkTrinoHasLoaded(sql, 30);if (!success) {Assertions.fail("Trino fail to load catalogs created by gravitino: " + sql);}String data = containerSuite.getTrinoContainer().executeQuerySQL(sql).get(0).get(0);- Assertions.assertEquals(metalakeName + "." + catalogName, data);+ Assertions.assertEquals(catalogName, data);catalog.asSchemas()@@ -1077,12 +1049,10 @@ public class TrinoConnectorIT extends AbstractIT {"Created by gravitino client",ImmutableMap.<String, String>builder().build());- sql =- String.format("show schemas in \"%s.%s\" like '%s'", metalakeName, catalogName, schemaName);+ sql = String.format("show schemas in %s like '%s'", catalogName, schemaName);Assertions.assertTrue(checkTrinoHasLoaded(sql, 30));- final String sql1 =- String.format("drop schema \"%s.%s\".%s cascade", metalakeName, catalogName, schemaName);+ final String sql1 = String.format("drop schema %s.%s cascade", catalogName, schemaName);// Will fail because the iceberg catalog does not support cascade dropTrinoContainer trinoContainer = containerSuite.getTrinoContainer();Assertions.assertThrows(@@ -1091,8 +1061,7 @@ public class TrinoConnectorIT extends AbstractIT {trinoContainer.executeUpdateSQL(sql1);});- final String sql2 =- String.format("show schemas in \"%s.%s\" like '%s'", metalakeName, catalogName, schemaName);+ final String sql2 = String.format("show schemas in %s like '%s'", catalogName, schemaName);success = checkTrinoHasLoaded(sql2, 30);if (!success) {Assertions.fail("Trino fail to load catalogs created by gravitino: " + sql2);@@ -1104,8 +1073,7 @@ public class TrinoConnectorIT extends AbstractIT {.asSchemas().dropSchema(NameIdentifier.of(metalakeName, catalogName, schemaName), true);Assertions.assertFalse(success);- final String sql3 =- String.format("show schemas in \"%s.%s\" like '%s'", metalakeName, catalogName, schemaName);+ final String sql3 = String.format("show schemas in %s like '%s'", catalogName, schemaName);success = checkTrinoHasLoaded(sql3, 30);if (!success) {Assertions.fail("Trino fail to load catalogs created by gravitino: " + sql);@@ -1143,14 +1111,14 @@ public class TrinoConnectorIT extends AbstractIT {Catalog catalog = createdMetalake.loadCatalog(NameIdentifier.of(metalakeName, catalogName));Assertions.assertEquals("root", catalog.properties().get("jdbc-user"));- String sql = String.format("show catalogs like '%s.%s'", metalakeName, catalogName);+ String sql = String.format("show catalogs like '%s'", catalogName);boolean success = checkTrinoHasLoaded(sql, 30);if (!success) {Assertions.fail("Trino fail to load catalogs created by gravitino: " + sql);}String data = containerSuite.getTrinoContainer().executeQuerySQL(sql).get(0).get(0);- Assertions.assertEquals(metalakeName + "." + catalogName, data);+ Assertions.assertEquals(catalogName, data);}@Test@@ -1186,14 +1154,14 @@ public class TrinoConnectorIT extends AbstractIT {Catalog catalog = createdMetalake.loadCatalog(NameIdentifier.of(metalakeName, catalogName));Assertions.assertEquals("root", catalog.properties().get("jdbc-user"));- String sql = String.format("show catalogs like '%s.%s'", metalakeName, catalogName);+ String sql = String.format("show catalogs like '%s'", catalogName);boolean success = checkTrinoHasLoaded(sql, 30);if (!success) {Assertions.fail("Trino fail to load catalogs created by gravitino: " + sql);}String data = containerSuite.getTrinoContainer().executeQuerySQL(sql).get(0).get(0);- Assertions.assertEquals(metalakeName + "." + catalogName, data);+ Assertions.assertEquals(catalogName, data);Schema schema =catalog@@ -1220,9 +1188,7 @@ public class TrinoConnectorIT extends AbstractIT {.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));Assertions.assertNotNull(table);- sql =- String.format(- "show create table \"%s.%s\".%s.%s", metalakeName, catalogName, schemaName, tableName);+ sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName);success = checkTrinoHasLoaded(sql, 30);if (!success) {@@ -1256,9 +1222,7 @@ public class TrinoConnectorIT extends AbstractIT {new Index[] {Indexes.createMysqlPrimaryKey(new String[][] {new String[] {"IntegerType"}})});- sql =- String.format(- "show create table \"%s.%s\".%s.%s", metalakeName, catalogName, schemaName, tableName);+ sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName);success = checkTrinoHasLoaded(sql, 30);if (!success) {@@ -1304,46 +1268,43 @@ public class TrinoConnectorIT extends AbstractIT {Catalog catalog = createdMetalake.loadCatalog(NameIdentifier.of(metalakeName, catalogName));Assertions.assertEquals("root", catalog.properties().get("jdbc-user"));- String sql = String.format("show catalogs like '%s.%s'", metalakeName, catalogName);+ String sql = String.format("show catalogs like '%s'", catalogName);boolean success = checkTrinoHasLoaded(sql, 30);if (!success) {Assertions.fail("Trino fail to load catalogs created by gravitino: " + sql);}String data = containerSuite.getTrinoContainer().executeQuerySQL(sql).get(0).get(0);- Assertions.assertEquals(metalakeName + "." + catalogName, data);+ Assertions.assertEquals(catalogName, data);// Create schema- sql = String.format("create schema \"%s.%s\".%s", metalakeName, catalogName, schemaName);+ sql = String.format("create schema %s.%s", catalogName, schemaName);containerSuite.getTrinoContainer().executeUpdateSQL(sql);// create tablesql =String.format(- "create table \"%s.%s\".%s.%s (id int, name varchar)",- metalakeName, catalogName, schemaName, tableName);+ "create table %s.%s.%s (id int, name varchar)", catalogName, schemaName, tableName);containerSuite.getTrinoContainer().executeUpdateSQL(sql);// Add a not null columnsql =String.format(- "alter table \"%s.%s\".%s.%s add column age int not null comment 'age of users'",- metalakeName, catalogName, schemaName, tableName);+ "alter table %s.%s.%s add column age int not null comment 'age of users'",+ catalogName, schemaName, tableName);containerSuite.getTrinoContainer().executeUpdateSQL(sql);sql =String.format(- "alter table \"%s.%s\".%s.%s add column address varchar(20) not null comment 'address of users'",- metalakeName, catalogName, schemaName, tableName);+ "alter table %s.%s.%s add column address varchar(20) not null comment 'address of users'",+ catalogName, schemaName, tableName);containerSuite.getTrinoContainer().executeUpdateSQL(sql);catalog.asTableCatalog().loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));- sql =- String.format(- "show create table \"%s.%s\".%s.%s", metalakeName, catalogName, schemaName, tableName);+ sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName);data = containerSuite.getTrinoContainer().executeQuerySQL(sql).get(0).get(0);Assertions.assertTrue(data.contains("age integer NOT NULL"));@@ -1353,57 +1314,45 @@ public class TrinoConnectorIT extends AbstractIT {String tableName1 = "t112";sql =String.format(- "create table \"%s.%s\".%s.%s (id int, t1name varchar)",- metalakeName, catalogName, schemaName, tableName1);+ "create table %s.%s.%s (id int, t1name varchar)", catalogName, schemaName, tableName1);containerSuite.getTrinoContainer().executeUpdateSQL(sql);String tableName2 = "t212";sql =String.format(- "create table \"%s.%s\".%s.%s (id int, t2name varchar)",- metalakeName, catalogName, schemaName, tableName2);+ "create table %s.%s.%s (id int, t2name varchar)", catalogName, schemaName, tableName2);containerSuite.getTrinoContainer().executeUpdateSQL(sql);String tableName3 = "t_12";sql =String.format(- "create table \"%s.%s\".%s.%s (id int, t3name varchar)",- metalakeName, catalogName, schemaName, tableName3);+ "create table %s.%s.%s (id int, t3name varchar)", catalogName, schemaName, tableName3);containerSuite.getTrinoContainer().executeUpdateSQL(sql);String tableName4 = "_1__";sql =String.format(- "create table \"%s.%s\".%s.%s (id int, t4name varchar)",- metalakeName, catalogName, schemaName, tableName4);+ "create table %s.%s.%s (id int, t4name varchar)", catalogName, schemaName, tableName4);containerSuite.getTrinoContainer().executeUpdateSQL(sql);// Get table tableName1- sql =- String.format(- "show create table \"%s.%s\".%s.%s", metalakeName, catalogName, schemaName, tableName1);+ sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName1);data = containerSuite.getTrinoContainer().executeQuerySQL(sql).get(0).get(0);data.contains("t1name varchar");// Get table tableName2- sql =- String.format(- "show create table \"%s.%s\".%s.%s", metalakeName, catalogName, schemaName, tableName2);+ sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName2);data = containerSuite.getTrinoContainer().executeQuerySQL(sql).get(0).get(0);data.contains("t2name varchar");// Get table tableName3- sql =- String.format(- "show create table \"%s.%s\".%s.%s", metalakeName, catalogName, schemaName, tableName3);+ sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName3);data = containerSuite.getTrinoContainer().executeQuerySQL(sql).get(0).get(0);data.contains("t3name varchar");// Get table tableName4- sql =- String.format(- "show create table \"%s.%s\".%s.%s", metalakeName, catalogName, schemaName, tableName4);+ sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName4);data = containerSuite.getTrinoContainer().executeQuerySQL(sql).get(0).get(0);data.contains("t4name varchar");}@@ -1440,7 +1389,7 @@ public class TrinoConnectorIT extends AbstractIT {.put("jdbc-url", String.format("jdbc:mysql://%s:3306?useSSL=false", hiveHost)).build());- String sql = String.format("show catalogs like '%s.%s'", metalakeName, catalogName);+ String sql = String.format("show catalogs like '%s'", catalogName);boolean success = checkTrinoHasLoaded(sql, 30);Assertions.assertTrue(success, "Trino should load the catalog: " + sql);diff --git a/integration-test/src/test/resources/trino-ci-testset/bugs/00002_alter_table_mysql.sql b/integration-test/src/test/resources/trino-ci-testset/bugs/00002_alter_table_mysql.sqldeleted file mode 100644index b26d9fe682..0000000000--- a/integration-test/src/test/resources/trino-ci-testset/bugs/00002_alter_table_mysql.sql+++ /dev/null@@ -1,16 +0,0 @@-CREATE SCHEMA "test.jdbc-mysql".gt_db1;--CREATE TABLE "test.jdbc-mysql".gt_db1.tb01 (- name varchar,- salary int-);--alter table "test.jdbc-mysql".gt_db1.tb01 rename column name to s;-show tables from "test.jdbc-mysql".gt_db1;--comment on table "test.jdbc-mysql".gt_db1.tb01 is 'test table comments';-show create table "test.jdbc-mysql".gt_db1.tb01;--comment on column "test.jdbc-mysql".gt_db1.tb01.s is 'test column comments';-show create table "test.jdbc-mysql".gt_db1.tb01;-diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00000_create_table.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00000_create_table.sqlindex 5df0dda6cd..e37f3fb736 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00000_create_table.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00000_create_table.sql@@ -1,6 +1,6 @@-CREATE SCHEMA "test.gt_hive".gt_db1;+CREATE SCHEMA gt_hive.gt_db1;-CREATE TABLE "test.gt_hive".gt_db1.tb01 (+CREATE TABLE gt_hive.gt_db1.tb01 (name varchar,salary int)@@ -8,6 +8,6 @@ WITH (format = 'TEXTFILE');-drop table "test.gt_hive".gt_db1.tb01;+drop table gt_hive.gt_db1.tb01;-drop schema "test.gt_hive".gt_db1;\ No newline at end of file+drop schema gt_hive.gt_db1;\ No newline at end of filediff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00001_select_table.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00001_select_table.sqlindex 5bd054d44d..4057536a82 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00001_select_table.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00001_select_table.sql@@ -1,6 +1,6 @@-CREATE SCHEMA "test.gt_hive".gt_db1;+CREATE SCHEMA gt_hive.gt_db1;-CREATE TABLE "test.gt_hive".gt_db1.tb01 (+CREATE TABLE gt_hive.gt_db1.tb01 (name varchar,salary int)@@ -8,13 +8,13 @@ WITH (format = 'TEXTFILE');-insert into "test.gt_hive".gt_db1.tb01(name, salary) values ('sam', 11);-insert into "test.gt_hive".gt_db1.tb01(name, salary) values ('jerry', 13);-insert into "test.gt_hive".gt_db1.tb01(name, salary) values ('bob', 14), ('tom', 12);+insert into gt_hive.gt_db1.tb01(name, salary) values ('sam', 11);+insert into gt_hive.gt_db1.tb01(name, salary) values ('jerry', 13);+insert into gt_hive.gt_db1.tb01(name, salary) values ('bob', 14), ('tom', 12);-select * from "test.gt_hive".gt_db1.tb01 order by name;+select * from gt_hive.gt_db1.tb01 order by name;-CREATE TABLE "test.gt_hive".gt_db1.tb02 (+CREATE TABLE gt_hive.gt_db1.tb02 (name varchar,salary int)@@ -22,12 +22,12 @@ WITH (format = 'TEXTFILE');-insert into "test.gt_hive".gt_db1.tb02(name, salary) select distinct * from "test.gt_hive".gt_db1.tb01 order by name;+insert into gt_hive.gt_db1.tb02(name, salary) select * from gt_hive.gt_db1.tb01 order by name;-select * from "test.gt_hive".gt_db1.tb02 order by name;+select * from gt_hive.gt_db1.tb02 order by name;-drop table "test.gt_hive".gt_db1.tb02;+drop table gt_hive.gt_db1.tb02;-drop table "test.gt_hive".gt_db1.tb01;+drop table gt_hive.gt_db1.tb01;-drop schema "test.gt_hive".gt_db1;+drop schema gt_hive.gt_db1;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00002_alter_table.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00002_alter_table.sqlindex dfca4f16e1..9c9e29b4ea 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00002_alter_table.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00002_alter_table.sql@@ -1,6 +1,6 @@-CREATE SCHEMA "test.gt_hive".gt_db1;+CREATE SCHEMA gt_hive.gt_db1;-CREATE TABLE "test.gt_hive".gt_db1.tb01 (+CREATE TABLE gt_hive.gt_db1.tb01 (name varchar,salary int,city int@@ -9,30 +9,30 @@ WITH (format = 'TEXTFILE');-alter table "test.gt_hive".gt_db1.tb01 rename to "test.gt_hive".gt_db1.tb03;-show tables from "test.gt_hive".gt_db1;+alter table gt_hive.gt_db1.tb01 rename to gt_hive.gt_db1.tb03;+show tables from gt_hive.gt_db1;-alter table "test.gt_hive".gt_db1.tb03 rename to "test.gt_hive".gt_db1.tb01;-show tables from "test.gt_hive".gt_db1;+alter table gt_hive.gt_db1.tb03 rename to gt_hive.gt_db1.tb01;+show tables from gt_hive.gt_db1;-alter table "test.gt_hive".gt_db1.tb01 drop column city;-show create table "test.gt_hive".gt_db1.tb01;+alter table gt_hive.gt_db1.tb01 drop column city;+show create table gt_hive.gt_db1.tb01;-alter table "test.gt_hive".gt_db1.tb01 rename column name to s;-show create table "test.gt_hive".gt_db1.tb01;+alter table gt_hive.gt_db1.tb01 rename column name to s;+show create table gt_hive.gt_db1.tb01;-alter table "test.gt_hive".gt_db1.tb01 alter column s set data type varchar(256);-show create table "test.gt_hive".gt_db1.tb01;+alter table gt_hive.gt_db1.tb01 alter column s set data type varchar(256);+show create table gt_hive.gt_db1.tb01;-comment on table "test.gt_hive".gt_db1.tb01 is 'test table comments';-show create table "test.gt_hive".gt_db1.tb01;+comment on table gt_hive.gt_db1.tb01 is 'test table comments';+show create table gt_hive.gt_db1.tb01;-comment on column "test.gt_hive".gt_db1.tb01.s is 'test column comments';-show create table "test.gt_hive".gt_db1.tb01;+comment on column gt_hive.gt_db1.tb01.s is 'test column comments';+show create table gt_hive.gt_db1.tb01;-alter table "test.gt_hive".gt_db1.tb01 add column city varchar comment 'aaa';-show create table "test.gt_hive".gt_db1.tb01;+alter table gt_hive.gt_db1.tb01 add column city varchar comment 'aaa';+show create table gt_hive.gt_db1.tb01;-drop table "test.gt_hive".gt_db1.tb01;+drop table gt_hive.gt_db1.tb01;-drop schema "test.gt_hive".gt_db1;+drop schema gt_hive.gt_db1;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00002_alter_table.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00002_alter_table.txtindex c759dfe1c9..d07f2e32e9 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00002_alter_table.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00002_alter_table.txt@@ -12,7 +12,7 @@ RENAME TABLEDROP COLUMN-"CREATE TABLE ""test.gt_hive"".gt_db1.tb01 (+"CREATE TABLE gt_hive.gt_db1.tb01 (name varchar,salary integer)@@ -30,7 +30,7 @@ WITH (RENAME COLUMN-"CREATE TABLE ""test.gt_hive"".gt_db1.tb01 (+"CREATE TABLE gt_hive.gt_db1.tb01 (s varchar,salary integer)@@ -48,7 +48,7 @@ WITH (SET COLUMN TYPE-"CREATE TABLE ""test.gt_hive"".gt_db1.tb01 (+"CREATE TABLE gt_hive.gt_db1.tb01 (s varchar(256),salary integer)@@ -66,7 +66,7 @@ WITH (COMMENT-"CREATE TABLE ""test.gt_hive"".gt_db1.tb01 (+"CREATE TABLE gt_hive.gt_db1.tb01 (s varchar(256),salary integer)@@ -84,7 +84,7 @@ WITH (COMMENT-"CREATE TABLE ""test.gt_hive"".gt_db1.tb01 (+"CREATE TABLE gt_hive.gt_db1.tb01 (s varchar(256) COMMENT 'test column comments',salary integer)@@ -102,7 +102,7 @@ WITH (ADD COLUMN-"CREATE TABLE ""test.gt_hive"".gt_db1.tb01 (+"CREATE TABLE gt_hive.gt_db1.tb01 (s varchar(256) COMMENT 'test column comments',salary integer,city varchar COMMENT 'aaa'diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00005_catalog.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00005_catalog.sqlindex 91daf2a79a..c33cba46da 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00005_catalog.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00005_catalog.sql@@ -7,11 +7,11 @@ call gravitino.system.create_catalog());-show catalogs like 'test.gt_hive_xxx1';+show catalogs like 'gt_hive_xxx1';CALL gravitino.system.drop_catalog('gt_hive_xxx1');-show catalogs like 'test.gt_hive_xxx1';+show catalogs like 'gt_hive_xxx1';call gravitino.system.create_catalog('gt_hive_xxx1',@@ -22,6 +22,6 @@ call gravitino.system.create_catalog());-show catalogs like 'test.gt_hive_xxx1';+show catalogs like 'gt_hive_xxx1';CALL gravitino.system.drop_catalog('gt_hive_xxx1');diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00005_catalog.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00005_catalog.txtindex 45ac31e08a..a9fb382877 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00005_catalog.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00005_catalog.txt@@ -1,6 +1,6 @@CALL-"test.gt_hive_xxx1"+"gt_hive_xxx1"CALL@@ -8,6 +8,6 @@ CALLCALL-"test.gt_hive_xxx1"+"gt_hive_xxx1"CALLdiff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00006_datatype.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00006_datatype.sqlindex a58417f671..4594188607 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00006_datatype.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00006_datatype.sql@@ -1,6 +1,6 @@-CREATE SCHEMA "test.gt_hive".gt_db1;+CREATE SCHEMA gt_hive.gt_db1;-USE "test.gt_hive".gt_db1;+USE gt_hive.gt_db1;-- Unsupported Type: TIMECREATE TABLE tb01 (@@ -32,4 +32,4 @@ select * from tb01 order by f1;drop table tb01;-drop schema "test.gt_hive".gt_db1 cascade;+drop schema gt_hive.gt_db1 cascade;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00006_datatype.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00006_datatype.txtindex e4269caa0f..33bedfdc75 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00006_datatype.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00006_datatype.txt@@ -4,7 +4,7 @@ USECREATE TABLE-"CREATE TABLE ""test.gt_hive"".gt_db1.tb01 (+"CREATE TABLE gt_hive.gt_db1.tb01 (f1 varchar(200),f2 char(20),f3 varbinary,diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00007_varchar.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00007_varchar.sqlindex 54dfd8b6f6..555f5d82b8 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00007_varchar.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00007_varchar.sql@@ -1,47 +1,47 @@-CREATE SCHEMA "test.gt_hive".varchar_db1;+CREATE SCHEMA gt_hive.varchar_db1;-USE "test.gt_hive".varchar_db1;+USE gt_hive.varchar_db1;CREATE TABLE tb01 (id int, name char(20));-SHOW CREATE TABLE "test.gt_hive".varchar_db1.tb01;+SHOW CREATE TABLE gt_hive.varchar_db1.tb01;CREATE TABLE tb02 (id int, name char(255));-SHOW CREATE TABLE "test.gt_hive".varchar_db1.tb02;+SHOW CREATE TABLE gt_hive.varchar_db1.tb02;CREATE TABLE tb03 (id int, name char(256));CREATE TABLE tb04 (id int, name varchar(250));-SHOW CREATE TABLE "test.gt_hive".varchar_db1.tb04;+SHOW CREATE TABLE gt_hive.varchar_db1.tb04;CREATE TABLE tb05 (id int, name varchar(65535));-SHOW CREATE TABLE "test.gt_hive".varchar_db1.tb05;+SHOW CREATE TABLE gt_hive.varchar_db1.tb05;CREATE TABLE tb06 (id int, name char);-SHOW CREATE TABLE "test.gt_hive".varchar_db1.tb06;+SHOW CREATE TABLE gt_hive.varchar_db1.tb06;CREATE TABLE tb07 (id int, name varchar);-SHOW CREATE TABLE "test.gt_hive".varchar_db1.tb07;+SHOW CREATE TABLE gt_hive.varchar_db1.tb07;CREATE TABLE tb08 (id int, name varchar(65536));-drop table "test.gt_hive".varchar_db1.tb01;+drop table gt_hive.varchar_db1.tb01;-drop table "test.gt_hive".varchar_db1.tb02;+drop table gt_hive.varchar_db1.tb02;-drop table "test.gt_hive".varchar_db1.tb04;+drop table gt_hive.varchar_db1.tb04;-drop table "test.gt_hive".varchar_db1.tb05;+drop table gt_hive.varchar_db1.tb05;-drop table "test.gt_hive".varchar_db1.tb06;+drop table gt_hive.varchar_db1.tb06;-drop table "test.gt_hive".varchar_db1.tb07;+drop table gt_hive.varchar_db1.tb07;-drop schema "test.gt_hive".varchar_db1;+drop schema gt_hive.varchar_db1;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00007_varchar.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00007_varchar.txtindex b69411fb75..77d6e77429 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00007_varchar.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00007_varchar.txt@@ -4,7 +4,7 @@ USECREATE TABLE-"CREATE TABLE ""test.gt_hive"".varchar_db1.tb01 (+"CREATE TABLE gt_hive.varchar_db1.tb01 (id integer,name char(20))@@ -20,7 +20,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_hive"".varchar_db1.tb02 (+"CREATE TABLE gt_hive.varchar_db1.tb02 (id integer,name char(255))@@ -38,7 +38,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_hive"".varchar_db1.tb04 (+"CREATE TABLE gt_hive.varchar_db1.tb04 (id integer,name varchar(250))@@ -54,7 +54,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_hive"".varchar_db1.tb05 (+"CREATE TABLE gt_hive.varchar_db1.tb05 (id integer,name varchar(65535))@@ -70,7 +70,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_hive"".varchar_db1.tb06 (+"CREATE TABLE gt_hive.varchar_db1.tb06 (id integer,name char(1))@@ -86,7 +86,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_hive"".varchar_db1.tb07 (+"CREATE TABLE gt_hive.varchar_db1.tb07 (id integer,name varchar)diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00000_create_table.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00000_create_table.sqlindex 09e50a1bec..e3804cde4a 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00000_create_table.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00000_create_table.sql@@ -1,61 +1,61 @@-CREATE SCHEMA "test.gt_mysql".gt_db1;+CREATE SCHEMA gt_mysql.gt_db1;-SHOW SCHEMAS FROM "test.gt_mysql" like 'gt_db1';+SHOW SCHEMAS FROM gt_mysql like 'gt_db1';-SHOW CREATE SCHEMA "test.gt_mysql".gt_db1;+SHOW CREATE SCHEMA gt_mysql.gt_db1;-CREATE SCHEMA "test.gt_mysql".gt_db1;+CREATE SCHEMA gt_mysql.gt_db1;-CREATE SCHEMA IF NOT EXISTS "test.gt_mysql".gt_db1;+CREATE SCHEMA IF NOT EXISTS gt_mysql.gt_db1;-CREATE SCHEMA IF NOT EXISTS "test.gt_mysql".gt_db2;+CREATE SCHEMA IF NOT EXISTS gt_mysql.gt_db2;-SHOW SCHEMAS FROM "test.gt_mysql" like 'gt_db2';+SHOW SCHEMAS FROM gt_mysql like 'gt_db2';-CREATE TABLE "test.gt_mysql".gt_db1.tb01 (+CREATE TABLE gt_mysql.gt_db1.tb01 (name varchar(200),salary int);-SHOW CREATE TABLE "test.gt_mysql".gt_db1.tb01;+SHOW CREATE TABLE gt_mysql.gt_db1.tb01;-SHOW tables FROM "test.gt_mysql".gt_db1 like 'tb01';+SHOW tables FROM gt_mysql.gt_db1 like 'tb01';-CREATE TABLE "test.gt_mysql".gt_db1.tb01 (+CREATE TABLE gt_mysql.gt_db1.tb01 (name varchar(200),salary int);-CREATE TABLE IF NOT EXISTS "test.gt_mysql".gt_db1.tb01 (+CREATE TABLE IF NOT EXISTS gt_mysql.gt_db1.tb01 (name varchar(200),salary int);-CREATE TABLE IF NOT EXISTS "test.gt_mysql".gt_db1.tb02 (+CREATE TABLE IF NOT EXISTS gt_mysql.gt_db1.tb02 (name varchar(200),salary int);-SHOW tables FROM "test.gt_mysql".gt_db1 like 'tb02';+SHOW tables FROM gt_mysql.gt_db1 like 'tb02';-DROP TABLE "test.gt_mysql".gt_db1.tb01;+DROP TABLE gt_mysql.gt_db1.tb01;-SHOW tables FROM "test.gt_mysql".gt_db1 like 'tb01';+SHOW tables FROM gt_mysql.gt_db1 like 'tb01';-DROP TABLE "test.gt_mysql".gt_db1.tb01;+DROP TABLE gt_mysql.gt_db1.tb01;-DROP TABLE IF EXISTS "test.gt_mysql".gt_db1.tb01;+DROP TABLE IF EXISTS gt_mysql.gt_db1.tb01;-DROP TABLE IF EXISTS "test.gt_mysql".gt_db1.tb02;+DROP TABLE IF EXISTS gt_mysql.gt_db1.tb02;-SHOW tables FROM "test.gt_mysql".gt_db1 like 'tb02';+SHOW tables FROM gt_mysql.gt_db1 like 'tb02';-DROP SCHEMA "test.gt_mysql".gt_db1;+DROP SCHEMA gt_mysql.gt_db1;-SHOW SCHEMAS FROM "test.gt_mysql" like 'gt_db1';+SHOW SCHEMAS FROM gt_mysql like 'gt_db1';-DROP SCHEMA IF EXISTS "test.gt_mysql".gt_db1;+DROP SCHEMA IF EXISTS gt_mysql.gt_db1;-DROP SCHEMA IF EXISTS "test.gt_mysql".gt_db2;+DROP SCHEMA IF EXISTS gt_mysql.gt_db2;-SHOW SCHEMAS FROM "test.gt_mysql" like 'gt_db2'+SHOW SCHEMAS FROM gt_mysql like 'gt_db2'diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00000_create_table.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00000_create_table.txtindex 7b78fbe07b..43da1446fc 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00000_create_table.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00000_create_table.txt@@ -2,9 +2,9 @@ CREATE SCHEMA"gt_db1"-"CREATE SCHEMA ""test.gt_mysql"".gt_db1"+"CREATE SCHEMA gt_mysql.gt_db1"-<QUERY_FAILED> Schema 'test.gt_mysql.gt_db1' already exists+<QUERY_FAILED> Schema 'gt_mysql.gt_db1' already existsCREATE SCHEMA@@ -14,7 +14,7 @@ CREATE SCHEMACREATE TABLE-"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (+"CREATE TABLE gt_mysql.gt_db1.tb01 (name varchar(200),salary integer)@@ -25,7 +25,7 @@ WITH ("tb01"-<QUERY_FAILED> Table 'test.gt_mysql.gt_db1.tb01' already exists+<QUERY_FAILED> Table 'gt_mysql.gt_db1.tb01' already existsCREATE TABLE@@ -37,7 +37,7 @@ DROP TABLE<BLANK_LINE>-<QUERY_FAILED> Table 'test.gt_mysql.gt_db1.tb01' does not exist+<QUERY_FAILED> Table 'gt_mysql.gt_db1.tb01' does not existDROP TABLEdiff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00001_select_table.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00001_select_table.sqlindex 51fc9066bd..ddf2105de4 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00001_select_table.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00001_select_table.sql@@ -1,29 +1,29 @@-CREATE SCHEMA "test.gt_mysql".gt_db1;+CREATE SCHEMA gt_mysql.gt_db1;-CREATE TABLE "test.gt_mysql".gt_db1.tb01 (+CREATE TABLE gt_mysql.gt_db1.tb01 (name varchar(200),salary int);-insert into "test.gt_mysql".gt_db1.tb01(name, salary) values ('sam', 11);-insert into "test.gt_mysql".gt_db1.tb01(name, salary) values ('jerry', 13);-insert into "test.gt_mysql".gt_db1.tb01(name, salary) values ('bob', 14), ('tom', 12);+insert into gt_mysql.gt_db1.tb01(name, salary) values ('sam', 11);+insert into gt_mysql.gt_db1.tb01(name, salary) values ('jerry', 13);+insert into gt_mysql.gt_db1.tb01(name, salary) values ('bob', 14), ('tom', 12);-select * from "test.gt_mysql".gt_db1.tb01 order by name;+select * from gt_mysql.gt_db1.tb01 order by name;-CREATE TABLE "test.gt_mysql".gt_db1.tb02 (+CREATE TABLE gt_mysql.gt_db1.tb02 (name varchar(200),salary int);-insert into "test.gt_mysql".gt_db1.tb02(name, salary) select distinct * from "test.gt_mysql".gt_db1.tb01 order by name;+insert into gt_mysql.gt_db1.tb02(name, salary) select * from gt_mysql.gt_db1.tb01 order by name;-select * from "test.gt_mysql".gt_db1.tb02 order by name;+select * from 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;+select * from gt_mysql.gt_db1.tb01 join 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 gt_mysql.gt_db1.tb02;-drop table "test.gt_mysql".gt_db1.tb01;+drop table gt_mysql.gt_db1.tb01;-drop schema "test.gt_mysql".gt_db1;+drop schema gt_mysql.gt_db1;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00002_alter_table.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00002_alter_table.sqlindex 0ce7326cad..b3af09a658 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00002_alter_table.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00002_alter_table.sql@@ -1,42 +1,42 @@-CREATE SCHEMA "test.gt_mysql".gt_db1;+CREATE SCHEMA gt_mysql.gt_db1;-CREATE TABLE "test.gt_mysql".gt_db1.tb01 (+CREATE TABLE gt_mysql.gt_db1.tb01 (name varchar(200),salary int,city int);-alter table "test.gt_mysql".gt_db1.tb01 rename to "test.gt_mysql".gt_db1.tb03;-show tables from "test.gt_mysql".gt_db1;+alter table gt_mysql.gt_db1.tb01 rename to gt_mysql.gt_db1.tb03;+show tables from gt_mysql.gt_db1;-alter table "test.gt_mysql".gt_db1.tb03 rename to "test.gt_mysql".gt_db1.tb01;-show tables from "test.gt_mysql".gt_db1;+alter table gt_mysql.gt_db1.tb03 rename to gt_mysql.gt_db1.tb01;+show tables from gt_mysql.gt_db1;-alter table "test.gt_mysql".gt_db1.tb01 drop column city;-show create table "test.gt_mysql".gt_db1.tb01;+alter table gt_mysql.gt_db1.tb01 drop column city;+show create table 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;+alter table gt_mysql.gt_db1.tb01 alter column salary set data type bigint;+show create table 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 column gt_mysql.gt_db1.tb01.name is 'test column comments';+show create table 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;+comment on table gt_mysql.gt_db1.tb01 is 'test table comments';+show create table 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 gt_mysql.gt_db1.tb01 rename column name to s;+show create table 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;+-- alter table gt_mysql.gt_db1.tb01 add column city varchar(50) not null comment 'aaa';+alter table gt_mysql.gt_db1.tb01 add column city varchar(50) comment 'aaa';+show create table gt_mysql.gt_db1.tb01;-alter table "test.gt_mysql".gt_db1.tb01 add column age int not null comment 'age of users';-show create table "test.gt_mysql".gt_db1.tb01;+alter table gt_mysql.gt_db1.tb01 add column age int not null comment 'age of users';+show create table gt_mysql.gt_db1.tb01;-alter table "test.gt_mysql".gt_db1.tb01 add column address varchar(200) not null comment 'address of users';-show create table "test.gt_mysql".gt_db1.tb01;+alter table gt_mysql.gt_db1.tb01 add column address varchar(200) not null comment 'address of users';+show create table gt_mysql.gt_db1.tb01;-drop table "test.gt_mysql".gt_db1.tb01;+drop table gt_mysql.gt_db1.tb01;-drop schema "test.gt_mysql".gt_db1;+drop schema gt_mysql.gt_db1;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00002_alter_table.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00002_alter_table.txtindex 2ace13f5db..3aa3144935 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00002_alter_table.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00002_alter_table.txt@@ -12,7 +12,7 @@ RENAME TABLEDROP COLUMN-"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (+"CREATE TABLE gt_mysql.gt_db1.tb01 (name varchar(200),salary integer)@@ -23,7 +23,7 @@ WITH (SET COLUMN TYPE-"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (+"CREATE TABLE gt_mysql.gt_db1.tb01 (name varchar(200),salary bigint)@@ -34,7 +34,7 @@ WITH (COMMENT-"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (+"CREATE TABLE gt_mysql.gt_db1.tb01 (name varchar(200) COMMENT 'test column comments',salary bigint)@@ -45,7 +45,7 @@ WITH (COMMENT-"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (+"CREATE TABLE gt_mysql.gt_db1.tb01 (name varchar(200) COMMENT 'test column comments',salary bigint)@@ -56,7 +56,7 @@ WITH (RENAME COLUMN-"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (+"CREATE TABLE gt_mysql.gt_db1.tb01 (s varchar(200) COMMENT 'test column comments',salary bigint)@@ -67,7 +67,7 @@ WITH (ADD COLUMN-"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (+"CREATE TABLE gt_mysql.gt_db1.tb01 (s varchar(200) COMMENT 'test column comments',salary bigint,city varchar(50) COMMENT 'aaa'@@ -79,7 +79,7 @@ WITH (ADD COLUMN-"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (+"CREATE TABLE gt_mysql.gt_db1.tb01 (s varchar(200) COMMENT 'test column comments',salary bigint,city varchar(50) COMMENT 'aaa',@@ -92,7 +92,7 @@ WITH (ADD COLUMN-"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (+"CREATE TABLE gt_mysql.gt_db1.tb01 (s varchar(200) COMMENT 'test column comments',salary bigint,city varchar(50) COMMENT 'aaa',diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00003_use.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00003_use.sqlindex 0b568e506a..7d2594b057 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00003_use.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00003_use.sql@@ -1,13 +1,13 @@-CREATE SCHEMA "test.gt_mysql".gt_db1;+CREATE SCHEMA gt_mysql.gt_db1;-USE "test.gt_mysql".gt_db1;+USE gt_mysql.gt_db1;CREATE TABLE tb01 (name varchar(200),salary int);-show tables from "test.gt_mysql".gt_db1;+show tables from gt_mysql.gt_db1;show tables;@@ -15,11 +15,11 @@ use tpch.tiny;show tables;-USE "test.gt_mysql".gt_db1;+USE gt_mysql.gt_db1;show tables;drop table tb01;-drop schema "test.gt_mysql".gt_db1;+drop schema gt_mysql.gt_db1;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00004_query_pushdown.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00004_query_pushdown.sqlindex 770e5a2530..a0fb5a6081 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00004_query_pushdown.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00004_query_pushdown.sql@@ -1,6 +1,6 @@-CREATE SCHEMA "test.gt_mysql".gt_db1;+CREATE SCHEMA gt_mysql.gt_db1;-USE "test.gt_mysql".gt_db1;+USE gt_mysql.gt_db1;CREATE TABLE customer (custkey bigint NOT NULL,@@ -48,4 +48,4 @@ drop table customer;drop table orders;-drop schema "test.gt_mysql".gt_db1;+drop schema gt_mysql.gt_db1;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00004_query_pushdown.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00004_query_pushdown.txtindex 3d4c52bc99..5e8e51a098 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00004_query_pushdown.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00004_query_pushdown.txt@@ -12,35 +12,35 @@ INSERT: 15000 rows"Trino version: %%- └─ TableScan[table = test.gt_mysql:gt_db1.customer gt_db1.customer limit=10 columns=[custkey:bigint:BIGINT]]+ └─ TableScan[table = gt_mysql:gt_db1.customer gt_db1.customer limit=10 columns=[custkey:bigint:BIGINT]]Layout: [custkey:bigint]%""Trino version: %%- └─ ScanFilter[table = test.gt_mysql:gt_db1:customer, filterPredicate = ""$like""(""phone"", ""$literal$""(from_base64('DgAAAFZBUklBQkxFX1dJRFRIAQAAAAEAAAALAAAAAAsAAAAGAAAAJTIzNDIlAA==')))]+ └─ ScanFilter[table = gt_mysql:gt_db1:customer, filterPredicate = ""$like""(""phone"", ""$literal$""(from_base64('DgAAAFZBUklBQkxFX1dJRFRIAQAAAAEAAAALAAAAAAsAAAAGAAAAJTIzNDIlAA==')))]Layout: [custkey:bigint, name:varchar(25), address:varchar(40), nationkey:bigint, phone:varchar(15), acctbal:decimal(12,2), mktsegment:varchar(10), comment:varchar(117)]%""Trino version: %%- └─ TableScan[table = test.gt_mysql:Query[SELECT sum(`totalprice`) AS `_pfgnrtd_0` FROM `gt_db1`.`orders`] columns=[_pfgnrtd_0:decimal(38,2):decimal]]+ └─ TableScan[table = gt_mysql:Query[SELECT sum(`totalprice`) AS `_pfgnrtd_0` FROM `gt_db1`.`orders`] columns=[_pfgnrtd_0:decimal(38,2):decimal]]Layout: [_pfgnrtd:decimal(38,2)]%""Trino version: %%- └─ TableScan[table = test.gt_mysql:Query[SELECT `orderdate`, sum(`totalprice`) AS `_pfgnrtd_0` FROM `gt_db1`.`orders` GROUP BY `orderdate`] sortOrder=[orderdate:date:DATE ASC NULLS LAST] limit=10 columns=[orderdate:date:DATE, _pfgnrtd_0:decimal(38,2):decimal]]+ └─ TableScan[table = gt_mysql:Query[SELECT `orderdate`, sum(`totalprice`) AS `_pfgnrtd_0` FROM `gt_db1`.`orders` GROUP BY `orderdate`] sortOrder=[orderdate:date:DATE ASC NULLS LAST] limit=10 columns=[orderdate:date:DATE, _pfgnrtd_0:decimal(38,2):decimal]]Layout: [orderdate:date, _pfgnrtd:decimal(38,2)]%""Trino version: %%- └─ TableScan[table = test.gt_mysql:Query[SELECT % INNER JOIN %] limit=10 columns=%]]+ └─ TableScan[table = gt_mysql:Query[SELECT % INNER JOIN %] limit=10 columns=%]]%"diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00005_create_catalog.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00005_create_catalog.sqlindex 8236cca350..dec476d959 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00005_create_catalog.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00005_create_catalog.sql@@ -7,7 +7,7 @@ call gravitino.system.create_catalog());-show catalogs like 'test.gt_mysql_xxx1';+show catalogs like 'gt_mysql_xxx1';call gravitino.system.create_catalog('gt_mysql_xxx1',@@ -30,7 +30,7 @@ call gravitino.system.create_catalog(CALL gravitino.system.drop_catalog('gt_mysql_xxx1');-show catalogs like 'test.gt_mysql_xxx1';+show catalogs like 'gt_mysql_xxx1';CALL gravitino.system.drop_catalog('gt_mysql_xxx1');@@ -45,9 +45,9 @@ call gravitino.system.create_catalog());-show catalogs like 'test.gt_mysql_xxx1';+show catalogs like 'gt_mysql_xxx1';CALL gravitino.system.drop_catalog(catalog => 'gt_mysql_xxx1', ignore_not_exist => true);-show catalogs like 'test.gt_mysql_xxx1';+show catalogs like 'gt_mysql_xxx1';diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00005_create_catalog.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00005_create_catalog.txtindex 198a59bacb..d17eaa68f9 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00005_create_catalog.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00005_create_catalog.txt@@ -1,6 +1,6 @@CALL-"test.gt_mysql_xxx1"+"gt_mysql_xxx1"<QUERY_FAILED> Catalog test.gt_mysql_xxx1 already exists.@@ -16,7 +16,7 @@ CALLCALL-"test.gt_mysql_xxx1"+"gt_mysql_xxx1"CALLdiff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00006_datatype.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00006_datatype.sqlindex 531d5d9921..f6f0ec755f 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00006_datatype.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00006_datatype.sql@@ -1,6 +1,6 @@-CREATE SCHEMA "test.gt_mysql".gt_db1;+CREATE SCHEMA gt_mysql.gt_db1;-USE "test.gt_mysql".gt_db1;+USE gt_mysql.gt_db1;-- Unsupported Type: BOOLEANCREATE TABLE tb01 (@@ -68,4 +68,4 @@ drop table tb01;drop table tb02;-drop schema "test.gt_mysql".gt_db1 cascade;+drop schema gt_mysql.gt_db1 cascade;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00006_datatype.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00006_datatype.txtindex d2629bda0d..fb63415a85 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00006_datatype.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00006_datatype.txt@@ -4,7 +4,7 @@ USECREATE TABLE-"CREATE TABLE ""test.gt_mysql"".gt_db1.tb01 (+"CREATE TABLE gt_mysql.gt_db1.tb01 (f1 varchar(200),f2 char(20),f3 varbinary,@@ -34,7 +34,7 @@ INSERT: 1 rowCREATE TABLE-"CREATE TABLE ""test.gt_mysql"".gt_db1.tb02 (+"CREATE TABLE gt_mysql.gt_db1.tb02 (f1 varchar(200) NOT NULL,f2 char(20) NOT NULL,f3 varbinary NOT NULL,diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00007_varchar.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00007_varchar.sqlindex a0143719f7..b1277532b4 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00007_varchar.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00007_varchar.sql@@ -1,44 +1,44 @@-CREATE SCHEMA "test.gt_mysql".varchar_db1;+CREATE SCHEMA gt_mysql.varchar_db1;-USE "test.gt_mysql".varchar_db1;+USE gt_mysql.varchar_db1;CREATE TABLE tb01 (id int, name char(20));-SHOW CREATE TABLE "test.gt_mysql".varchar_db1.tb01;+SHOW CREATE TABLE gt_mysql.varchar_db1.tb01;CREATE TABLE tb02 (id int, name char(255));-SHOW CREATE TABLE "test.gt_mysql".varchar_db1.tb02;+SHOW CREATE TABLE gt_mysql.varchar_db1.tb02;CREATE TABLE tb03 (id int, name char(256));CREATE TABLE tb04 (id int, name varchar(250));-SHOW CREATE TABLE "test.gt_mysql".varchar_db1.tb04;+SHOW CREATE TABLE gt_mysql.varchar_db1.tb04;CREATE TABLE tb05 (id int, name varchar(256));-SHOW CREATE TABLE "test.gt_mysql".varchar_db1.tb05;+SHOW CREATE TABLE gt_mysql.varchar_db1.tb05;CREATE TABLE tb06 (id int, name char);-SHOW CREATE TABLE "test.gt_mysql".varchar_db1.tb06;+SHOW CREATE TABLE gt_mysql.varchar_db1.tb06;CREATE TABLE tb07 (id int, name varchar);-SHOW CREATE TABLE "test.gt_mysql".varchar_db1.tb07;+SHOW CREATE TABLE gt_mysql.varchar_db1.tb07;-drop table "test.gt_mysql".varchar_db1.tb01;+drop table gt_mysql.varchar_db1.tb01;-drop table "test.gt_mysql".varchar_db1.tb02;+drop table gt_mysql.varchar_db1.tb02;-drop table "test.gt_mysql".varchar_db1.tb04;+drop table gt_mysql.varchar_db1.tb04;-drop table "test.gt_mysql".varchar_db1.tb05;+drop table gt_mysql.varchar_db1.tb05;-drop table "test.gt_mysql".varchar_db1.tb06;+drop table gt_mysql.varchar_db1.tb06;-drop table "test.gt_mysql".varchar_db1.tb07;+drop table gt_mysql.varchar_db1.tb07;-drop schema "test.gt_mysql".varchar_db1;+drop schema gt_mysql.varchar_db1;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00007_varchar.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00007_varchar.txtindex cbad718d69..a239050a77 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00007_varchar.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00007_varchar.txt@@ -4,7 +4,7 @@ USECREATE TABLE-"CREATE TABLE ""test.gt_mysql"".varchar_db1.tb01 (+"CREATE TABLE gt_mysql.varchar_db1.tb01 (id integer,name char(20))@@ -15,7 +15,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_mysql"".varchar_db1.tb02 (+"CREATE TABLE gt_mysql.varchar_db1.tb02 (id integer,name char(255))@@ -28,7 +28,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_mysql"".varchar_db1.tb04 (+"CREATE TABLE gt_mysql.varchar_db1.tb04 (id integer,name varchar(250))@@ -39,7 +39,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_mysql"".varchar_db1.tb05 (+"CREATE TABLE gt_mysql.varchar_db1.tb05 (id integer,name varchar(256))@@ -50,7 +50,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_mysql"".varchar_db1.tb06 (+"CREATE TABLE gt_mysql.varchar_db1.tb06 (id integer,name char(1))@@ -61,7 +61,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_mysql"".varchar_db1.tb07 (+"CREATE TABLE gt_mysql.varchar_db1.tb07 (id integer,name varchar)diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00008_alter_catalog.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00008_alter_catalog.sqlindex dba2caf829..46d8b8c803 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00008_alter_catalog.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00008_alter_catalog.sql@@ -7,7 +7,7 @@ call gravitino.system.create_catalog());-select * from gravitino.system.catalog where name = 'test.gt_mysql_xxx1';+select * from gravitino.system.catalog where name = 'gt_mysql_xxx1';call gravitino.system.alter_catalog('gt_mysql_xxx1',@@ -17,7 +17,7 @@ call gravitino.system.alter_catalog());-select * from gravitino.system.catalog where name = 'test.gt_mysql_xxx1';+select * from gravitino.system.catalog where name = 'gt_mysql_xxx1';call gravitino.system.alter_catalog('gt_mysql_xxx1',@@ -25,7 +25,7 @@ call gravitino.system.alter_catalog(array['join-pushdown.strategy']);-select * from gravitino.system.catalog where name = 'test.gt_mysql_xxx1';+select * from gravitino.system.catalog where name = 'gt_mysql_xxx1';call gravitino.system.alter_catalog(catalog => 'gt_mysql_xxx1',@@ -36,6 +36,6 @@ call gravitino.system.alter_catalog(remove_properties => array['test_key']);-select * from gravitino.system.catalog where name = 'test.gt_mysql_xxx1';+select * from gravitino.system.catalog where name = 'gt_mysql_xxx1';call gravitino.system.drop_catalog('gt_mysql_xxx1');\ No newline at end of filediff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00008_alter_catalog.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00008_alter_catalog.txtindex 6f62f06201..b0e3aac0dc 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00008_alter_catalog.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-mysql/00008_alter_catalog.txt@@ -1,17 +1,17 @@CALL-"test.gt_mysql_xxx1","jdbc-mysql","{""jdbc-url"":""jdbc:mysql://%/?useSSL=false"",""jdbc-user"":""trino"",""jdbc-password"":""ds123"",""jdbc-driver"":""com.mysql.cj.jdbc.Driver""}"+"gt_mysql_xxx1","jdbc-mysql","{""jdbc-url"":""jdbc:mysql://%/?useSSL=false"",""jdbc-user"":""trino"",""jdbc-password"":""ds123"",""jdbc-driver"":""com.mysql.cj.jdbc.Driver""}"CALL-"test.gt_mysql_xxx1","jdbc-mysql","{""join-pushdown.strategy"":""EAGER"",""jdbc-url"":""jdbc:mysql://%/?useSSL=false"",""jdbc-user"":""trino"",""jdbc-password"":""ds123"",""jdbc-driver"":""com.mysql.cj.jdbc.Driver"",""test_key"":""test_value""}"+"gt_mysql_xxx1","jdbc-mysql","{""join-pushdown.strategy"":""EAGER"",""jdbc-url"":""jdbc:mysql://%/?useSSL=false"",""jdbc-user"":""trino"",""jdbc-password"":""ds123"",""jdbc-driver"":""com.mysql.cj.jdbc.Driver"",""test_key"":""test_value""}"CALL-"test.gt_mysql_xxx1","jdbc-mysql","{""jdbc-url"":""jdbc:mysql://%/?useSSL=false"",""jdbc-user"":""trino"",""jdbc-password"":""ds123"",""jdbc-driver"":""com.mysql.cj.jdbc.Driver"",""test_key"":""test_value""}"+"gt_mysql_xxx1","jdbc-mysql","{""jdbc-url"":""jdbc:mysql://%/?useSSL=false"",""jdbc-user"":""trino"",""jdbc-password"":""ds123"",""jdbc-driver"":""com.mysql.cj.jdbc.Driver"",""test_key"":""test_value""}"CALL-"test.gt_mysql_xxx1","jdbc-mysql","{""join-pushdown.strategy"":""EAGER"",""jdbc-url"":""jdbc:mysql://%/?useSSL=false"",""jdbc-user"":""trino"",""jdbc-password"":""ds123"",""jdbc-driver"":""com.mysql.cj.jdbc.Driver""}"+"gt_mysql_xxx1","jdbc-mysql","{""join-pushdown.strategy"":""EAGER"",""jdbc-url"":""jdbc:mysql://%/?useSSL=false"",""jdbc-user"":""trino"",""jdbc-password"":""ds123"",""jdbc-driver"":""com.mysql.cj.jdbc.Driver""}"CALL\ No newline at end of filediff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00000_create_table.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00000_create_table.sqlindex 0a2f81a7ef..9705111cd4 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00000_create_table.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00000_create_table.sql@@ -1,10 +1,10 @@-CREATE SCHEMA "test.gt_postgresql".gt_db1;+CREATE SCHEMA gt_postgresql.gt_db1;-CREATE TABLE "test.gt_postgresql".gt_db1.tb01 (+CREATE TABLE gt_postgresql.gt_db1.tb01 (name varchar,salary int);-drop table "test.gt_postgresql".gt_db1.tb01;+drop table gt_postgresql.gt_db1.tb01;-drop schema "test.gt_postgresql".gt_db1;\ No newline at end of file+drop schema gt_postgresql.gt_db1;\ No newline at end of filediff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00001_select_table.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00001_select_table.sqlindex e595cfabd1..b084c6568b 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00001_select_table.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00001_select_table.sql@@ -1,27 +1,27 @@-CREATE SCHEMA "test.gt_postgresql".gt_db1;+CREATE SCHEMA gt_postgresql.gt_db1;-CREATE TABLE "test.gt_postgresql".gt_db1.tb01 (+CREATE TABLE gt_postgresql.gt_db1.tb01 (name varchar,salary int);-insert into "test.gt_postgresql".gt_db1.tb01(name, salary) values ('sam', 11);-insert into "test.gt_postgresql".gt_db1.tb01(name, salary) values ('jerry', 13);-insert into "test.gt_postgresql".gt_db1.tb01(name, salary) values ('bob', 14), ('tom', 12);+insert into gt_postgresql.gt_db1.tb01(name, salary) values ('sam', 11);+insert into gt_postgresql.gt_db1.tb01(name, salary) values ('jerry', 13);+insert into gt_postgresql.gt_db1.tb01(name, salary) values ('bob', 14), ('tom', 12);-select * from "test.gt_postgresql".gt_db1.tb01 order by name;+select * from gt_postgresql.gt_db1.tb01 order by name;-CREATE TABLE "test.gt_postgresql".gt_db1.tb02 (+CREATE TABLE gt_postgresql.gt_db1.tb02 (name varchar,salary int);-insert into "test.gt_postgresql".gt_db1.tb02(name, salary) select distinct * from "test.gt_postgresql".gt_db1.tb01 order by name;+insert into gt_postgresql.gt_db1.tb02(name, salary) select * from gt_postgresql.gt_db1.tb01 order by name;-select * from "test.gt_postgresql".gt_db1.tb02 order by name;+select * from gt_postgresql.gt_db1.tb02 order by name;-drop table "test.gt_postgresql".gt_db1.tb02;+drop table gt_postgresql.gt_db1.tb02;-drop table "test.gt_postgresql".gt_db1.tb01;+drop table gt_postgresql.gt_db1.tb01;-drop schema "test.gt_postgresql".gt_db1;\ No newline at end of file+drop schema gt_postgresql.gt_db1;\ No newline at end of filediff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00002_alter_table.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00002_alter_table.sqlindex 96214720c4..da78532d10 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00002_alter_table.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00002_alter_table.sql@@ -1,35 +1,35 @@-CREATE SCHEMA "test.gt_postgresql".gt_db1;+CREATE SCHEMA gt_postgresql.gt_db1;-CREATE TABLE "test.gt_postgresql".gt_db1.tb01 (+CREATE TABLE gt_postgresql.gt_db1.tb01 (name varchar,salary int,city int);-alter table "test.gt_postgresql".gt_db1.tb01 rename to "test.gt_postgresql".gt_db1.tb03;-show tables from "test.gt_postgresql".gt_db1;+alter table gt_postgresql.gt_db1.tb01 rename to gt_postgresql.gt_db1.tb03;+show tables from gt_postgresql.gt_db1;-alter table "test.gt_postgresql".gt_db1.tb03 rename to "test.gt_postgresql".gt_db1.tb01;-show tables from "test.gt_postgresql".gt_db1;+alter table gt_postgresql.gt_db1.tb03 rename to gt_postgresql.gt_db1.tb01;+show tables from gt_postgresql.gt_db1;-alter table "test.gt_postgresql".gt_db1.tb01 drop column city;-show create table "test.gt_postgresql".gt_db1.tb01;+alter table gt_postgresql.gt_db1.tb01 drop column city;+show create table gt_postgresql.gt_db1.tb01;-alter table "test.gt_postgresql".gt_db1.tb01 alter column salary set data type bigint;-show create table "test.gt_postgresql".gt_db1.tb01;+alter table gt_postgresql.gt_db1.tb01 alter column salary set data type bigint;+show create table gt_postgresql.gt_db1.tb01;-comment on table "test.gt_postgresql".gt_db1.tb01 is 'test table comments';-show create table "test.gt_postgresql".gt_db1.tb01;+comment on table gt_postgresql.gt_db1.tb01 is 'test table comments';+show create table gt_postgresql.gt_db1.tb01;-alter table "test.gt_postgresql".gt_db1.tb01 rename column name to s;-show create table "test.gt_postgresql".gt_db1.tb01;+alter table gt_postgresql.gt_db1.tb01 rename column name to s;+show create table gt_postgresql.gt_db1.tb01;-comment on column "test.gt_postgresql".gt_db1.tb01.s is 'test column comments';-show create table "test.gt_postgresql".gt_db1.tb01;+comment on column gt_postgresql.gt_db1.tb01.s is 'test column comments';+show create table gt_postgresql.gt_db1.tb01;-alter table "test.gt_postgresql".gt_db1.tb01 add column city varchar comment 'aaa';-show create table "test.gt_postgresql".gt_db1.tb01;+alter table gt_postgresql.gt_db1.tb01 add column city varchar comment 'aaa';+show create table gt_postgresql.gt_db1.tb01;-drop table "test.gt_postgresql".gt_db1.tb01;+drop table gt_postgresql.gt_db1.tb01;-drop schema "test.gt_postgresql".gt_db1;+drop schema gt_postgresql.gt_db1;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00002_alter_table.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00002_alter_table.txtindex 72fb2754ff..e34adddb64 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00002_alter_table.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00002_alter_table.txt@@ -12,7 +12,7 @@ RENAME TABLEDROP COLUMN-"CREATE TABLE ""test.gt_postgresql"".gt_db1.tb01 (+"CREATE TABLE gt_postgresql.gt_db1.tb01 (name varchar,salary integer)@@ -20,7 +20,7 @@ COMMENT ''"SET COLUMN TYPE-"CREATE TABLE ""test.gt_postgresql"".gt_db1.tb01 (+"CREATE TABLE gt_postgresql.gt_db1.tb01 (name varchar,salary bigint)@@ -28,7 +28,7 @@ COMMENT ''"COMMENT-"CREATE TABLE ""test.gt_postgresql"".gt_db1.tb01 (+"CREATE TABLE gt_postgresql.gt_db1.tb01 (name varchar,salary bigint)@@ -36,7 +36,7 @@ COMMENT 'test table comments'"RENAME COLUMN-"CREATE TABLE ""test.gt_postgresql"".gt_db1.tb01 (+"CREATE TABLE gt_postgresql.gt_db1.tb01 (s varchar,salary bigint)@@ -44,7 +44,7 @@ COMMENT 'test table comments'"COMMENT-"CREATE TABLE ""test.gt_postgresql"".gt_db1.tb01 (+"CREATE TABLE gt_postgresql.gt_db1.tb01 (s varchar COMMENT 'test column comments',salary bigint)@@ -52,7 +52,7 @@ COMMENT 'test table comments'"ADD COLUMN-"CREATE TABLE ""test.gt_postgresql"".gt_db1.tb01 (+"CREATE TABLE gt_postgresql.gt_db1.tb01 (s varchar COMMENT 'test column comments',salary bigint,city varchar COMMENT 'aaa'diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00003_join_pushdown.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00003_join_pushdown.sqlindex aca9064581..a0c47d7162 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00003_join_pushdown.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00003_join_pushdown.sql@@ -1,15 +1,15 @@-CREATE SCHEMA "test.gt_postgresql".gt_db1;+CREATE SCHEMA gt_postgresql.gt_db1;-use "test.gt_postgresql".gt_db1;+use gt_postgresql.gt_db1;-CREATE TABLE "test.gt_postgresql".gt_db1.employee_performance (+CREATE TABLE gt_postgresql.gt_db1.employee_performance (employee_id integer,evaluation_date date,rating integer)COMMENT 'comment';-CREATE TABLE "test.gt_postgresql".gt_db1.employees (+CREATE TABLE gt_postgresql.gt_db1.employees (employee_id integer,department_id integer,job_title varchar(100),@@ -20,7 +20,7 @@ CREATE TABLE "test.gt_postgresql".gt_db1.employees ()COMMENT 'comment';-INSERT INTO "test.gt_postgresql".gt_db1.employee_performance (employee_id, evaluation_date, rating) VALUES+INSERT INTO gt_postgresql.gt_db1.employee_performance (employee_id, evaluation_date, rating) VALUES(1, DATE '2018-02-24', 4),(1, DATE '2016-12-25', 7),(1, DATE '2023-04-07', 4),@@ -32,7 +32,7 @@ INSERT INTO "test.gt_postgresql".gt_db1.employee_performance (employee_id, evalu(3, DATE '2021-01-05', 6),(3, DATE '2014-10-24', 4);-INSERT INTO "test.gt_postgresql".gt_db1.employees (employee_id, department_id, job_title, given_name, family_name, birth_date, hire_date) VALUES+INSERT INTO gt_postgresql.gt_db1.employees (employee_id, department_id, job_title, given_name, family_name, birth_date, hire_date) VALUES(1, 1, 'Manager', 'Gregory', 'Smith', DATE '1968-04-15', DATE '2014-06-04'),(2, 1, 'Sales Assistant', 'Owen', 'Rivers', DATE '1988-08-13', DATE '2021-02-05'),(3, 1, 'Programmer', 'Avram', 'Lawrence', DATE '1969-11-21', DATE '2010-09-29'),@@ -48,14 +48,14 @@ SELECTgiven_name,family_name,rating-FROM "test.gt_postgresql".gt_db1.employee_performance AS p-JOIN "test.gt_postgresql".gt_db1.employees AS e+FROM gt_postgresql.gt_db1.employee_performance AS p+JOIN gt_postgresql.gt_db1.employees AS eON p.employee_id = e.employee_idORDER BYrating DESC, given_nameLIMIT 10;-drop table "test.gt_postgresql".gt_db1.employee_performance;-drop table "test.gt_postgresql".gt_db1.employees;+drop table gt_postgresql.gt_db1.employee_performance;+drop table gt_postgresql.gt_db1.employees;-drop schema "test.gt_postgresql".gt_db1;\ No newline at end of file+drop schema gt_postgresql.gt_db1;\ No newline at end of filediff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00004_query_pushdown.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00004_query_pushdown.sqlindex d5a16ec588..59760a2a31 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00004_query_pushdown.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00004_query_pushdown.sql@@ -1,6 +1,6 @@-CREATE SCHEMA "test.gt_postgresql".gt_db1;+CREATE SCHEMA gt_postgresql.gt_db1;-use "test.gt_postgresql".gt_db1;+use gt_postgresql.gt_db1;CREATE TABLE customer (custkey bigint NOT NULL,@@ -48,4 +48,4 @@ drop table customer;drop table orders;-drop schema "test.gt_postgresql".gt_db1;;+drop schema gt_postgresql.gt_db1;;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00004_query_pushdown.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00004_query_pushdown.txtindex d5fe30a858..a823283fe1 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00004_query_pushdown.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00004_query_pushdown.txt@@ -12,35 +12,35 @@ INSERT: 15000 rows"Trino version: %%- └─ TableScan[table = test.gt_postgresql:gt_db1.customer gt_db1.customer limit=10 columns=[custkey:bigint:int8]]+ └─ TableScan[table = gt_postgresql:gt_db1.customer gt_db1.customer limit=10 columns=[custkey:bigint:int8]]Layout: [custkey:bigint]%""Trino version: %%- └─ TableScan[table = test.gt_postgresql:gt_db1.customer gt_db1.customer constraints=[ParameterizedExpression[expression=(""phone"") LIKE (?), parameters=[QueryParameter{jdbcType=Optional.empty, type=varchar(6), value=Optional[Slice{base=[B@%, baseOffset=0, length=6}]}]]] limit=10]+ └─ TableScan[table = gt_postgresql:gt_db1.customer gt_db1.customer constraints=[ParameterizedExpression[expression=(""phone"") LIKE (?), parameters=[QueryParameter{jdbcType=Optional.empty, type=varchar(6), value=Optional[Slice{base=[B@%, baseOffset=0, length=6}]}]]] limit=10]Layout: [custkey:bigint, name:varchar(25), address:varchar(40), nationkey:bigint, phone:varchar(15), acctbal:decimal(12,2), mktsegment:varchar(10), comment:varchar(117)]%""Trino version: %%- └─ TableScan[table = test.gt_postgresql:Query[SELECT sum(""totalprice"") AS ""_pfgnrtd_0"" FROM ""gt_db1"".""orders""] columns=[_pfgnrtd_0:decimal(38,2):decimal]]+ └─ TableScan[table = gt_postgresql:Query[SELECT sum(""totalprice"") AS ""_pfgnrtd_0"" FROM ""gt_db1"".""orders""] columns=[_pfgnrtd_0:decimal(38,2):decimal]]Layout: [_pfgnrtd:decimal(38,2)]%""Trino version: %%- └─ TableScan[table = test.gt_postgresql:Query[SELECT ""orderdate"", sum(""totalprice"") AS ""_pfgnrtd_0"" FROM ""gt_db1"".""orders"" GROUP BY ""orderdate""] sortOrder=[orderdate:date:date ASC NULLS LAST] limit=10 columns=[orderdate:date:date, _pfgnrtd_0:decimal(38,2):decimal]]+ └─ TableScan[table = gt_postgresql:Query[SELECT ""orderdate"", sum(""totalprice"") AS ""_pfgnrtd_0"" FROM ""gt_db1"".""orders"" GROUP BY ""orderdate""] sortOrder=[orderdate:date:date ASC NULLS LAST] limit=10 columns=[orderdate:date:date, _pfgnrtd_0:decimal(38,2):decimal]]Layout: [orderdate:date, _pfgnrtd:decimal(38,2)]%""Trino version: %%- TableScan[table = test.gt_postgresql:Query[SELECT % INNER JOIN %] limit=10 columns=%]+ TableScan[table = gt_postgresql:Query[SELECT % INNER JOIN %] limit=10 columns=%]%"diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.sqlindex d67997d2b8..0f3327f104 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.sql@@ -1,6 +1,6 @@-CREATE SCHEMA "test.gt_postgresql".gt_db1;+CREATE SCHEMA gt_postgresql.gt_db1;-USE "test.gt_postgresql".gt_db1;+USE gt_postgresql.gt_db1;-- Unsupported Type: TINYINTCREATE TABLE tb01 (@@ -69,4 +69,4 @@ drop table tb01;drop table tb02;-drop schema "test.gt_postgresql".gt_db1 cascade;+drop schema gt_postgresql.gt_db1 cascade;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.txtindex 4c3789a351..42a88b7705 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.txt@@ -4,7 +4,7 @@ USECREATE TABLE-"CREATE TABLE ""test.gt_postgresql"".gt_db1.tb01 (+"CREATE TABLE gt_postgresql.gt_db1.tb01 (f1 varchar(200),f2 char(20),f3 varbinary,@@ -31,7 +31,7 @@ INSERT: 1 rowCREATE TABLE-"CREATE TABLE ""test.gt_postgresql"".gt_db1.tb02 (+"CREATE TABLE gt_postgresql.gt_db1.tb02 (f1 varchar(200) NOT NULL,f2 char(20) NOT NULL,f3 varbinary NOT NULL,diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00007_varchar.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00007_varchar.sqlindex b21f99f9d2..8e911501be 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00007_varchar.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00007_varchar.sql@@ -1,46 +1,46 @@-CREATE SCHEMA "test.gt_postgresql".varchar_db1;+CREATE SCHEMA gt_postgresql.varchar_db1;-USE "test.gt_postgresql".varchar_db1;+USE gt_postgresql.varchar_db1;CREATE TABLE tb01 (id int, name char(20));-SHOW CREATE TABLE "test.gt_postgresql".varchar_db1.tb01;+SHOW CREATE TABLE gt_postgresql.varchar_db1.tb01;CREATE TABLE tb02 (id int, name char(65536));-SHOW CREATE TABLE "test.gt_postgresql".varchar_db1.tb02;+SHOW CREATE TABLE gt_postgresql.varchar_db1.tb02;CREATE TABLE tb03 (id int, name char(65537));CREATE TABLE tb04 (id int, name varchar(250));-SHOW CREATE TABLE "test.gt_postgresql".varchar_db1.tb04;+SHOW CREATE TABLE gt_postgresql.varchar_db1.tb04;CREATE TABLE tb05 (id int, name varchar(10485760));-SHOW CREATE TABLE "test.gt_postgresql".varchar_db1.tb05;+SHOW CREATE TABLE gt_postgresql.varchar_db1.tb05;CREATE TABLE tb06 (id int, name varchar(10485761));CREATE TABLE tb06 (id int, name char);-SHOW CREATE TABLE "test.gt_postgresql".varchar_db1.tb06;+SHOW CREATE TABLE gt_postgresql.varchar_db1.tb06;CREATE TABLE tb07 (id int, name varchar);-SHOW CREATE TABLE "test.gt_postgresql".varchar_db1.tb07;+SHOW CREATE TABLE gt_postgresql.varchar_db1.tb07;-drop table "test.gt_postgresql".varchar_db1.tb01;+drop table gt_postgresql.varchar_db1.tb01;-drop table "test.gt_postgresql".varchar_db1.tb02;+drop table gt_postgresql.varchar_db1.tb02;-drop table "test.gt_postgresql".varchar_db1.tb04;+drop table gt_postgresql.varchar_db1.tb04;-drop table "test.gt_postgresql".varchar_db1.tb05;+drop table gt_postgresql.varchar_db1.tb05;-drop table "test.gt_postgresql".varchar_db1.tb06;+drop table gt_postgresql.varchar_db1.tb06;-drop table "test.gt_postgresql".varchar_db1.tb07;+drop table gt_postgresql.varchar_db1.tb07;-drop schema "test.gt_postgresql".varchar_db1;+drop schema gt_postgresql.varchar_db1;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00007_varchar.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00007_varchar.txtindex f7776c53be..ad1e5b1308 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00007_varchar.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00007_varchar.txt@@ -4,7 +4,7 @@ USECREATE TABLE-"CREATE TABLE ""test.gt_postgresql"".varchar_db1.tb01 (+"CREATE TABLE gt_postgresql.varchar_db1.tb01 (id integer,name char(20))@@ -12,7 +12,7 @@ COMMENT ''"CREATE TABLE-"CREATE TABLE ""test.gt_postgresql"".varchar_db1.tb02 (+"CREATE TABLE gt_postgresql.varchar_db1.tb02 (id integer,name char(65536))@@ -22,7 +22,7 @@ COMMENT ''"CREATE TABLE-"CREATE TABLE ""test.gt_postgresql"".varchar_db1.tb04 (+"CREATE TABLE gt_postgresql.varchar_db1.tb04 (id integer,name varchar(250))@@ -30,7 +30,7 @@ COMMENT ''"CREATE TABLE-"CREATE TABLE ""test.gt_postgresql"".varchar_db1.tb05 (+"CREATE TABLE gt_postgresql.varchar_db1.tb05 (id integer,name varchar(10485760))@@ -40,7 +40,7 @@ COMMENT ''"CREATE TABLE-"CREATE TABLE ""test.gt_postgresql"".varchar_db1.tb06 (+"CREATE TABLE gt_postgresql.varchar_db1.tb06 (id integer,name char(1))@@ -48,7 +48,7 @@ COMMENT ''"CREATE TABLE-"CREATE TABLE ""test.gt_postgresql"".varchar_db1.tb07 (+"CREATE TABLE gt_postgresql.varchar_db1.tb07 (id integer,name varchar)diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00000_create_table.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00000_create_table.sqlindex 83e47dda27..a2936fb131 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00000_create_table.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00000_create_table.sql@@ -1,13 +1,13 @@-CREATE SCHEMA "test.gt_iceberg".gt_db2;+CREATE SCHEMA gt_iceberg.gt_db2;-CREATE TABLE "test.gt_iceberg".gt_db2.tb01(+CREATE TABLE gt_iceberg.gt_db2.tb01(name varchar,salary int);-show create table "test.gt_iceberg".gt_db2.tb01;+show create table gt_iceberg.gt_db2.tb01;-CREATE TABLE "test.gt_iceberg".gt_db2.tb02 (+CREATE TABLE gt_iceberg.gt_db2.tb02 (name varchar,salary int) with (@@ -15,9 +15,9 @@ CREATE TABLE "test.gt_iceberg".gt_db2.tb02 (sorted_by = ARRAY['salary']);-show create table "test.gt_iceberg".gt_db2.tb02;+show create table gt_iceberg.gt_db2.tb02;-CREATE TABLE "test.gt_iceberg".gt_db2.tb03 (+CREATE TABLE gt_iceberg.gt_db2.tb03 (name varchar,salary int) with (@@ -25,7 +25,7 @@ CREATE TABLE "test.gt_iceberg".gt_db2.tb03 (sorted_by = ARRAY['salary_wrong_name']);-CREATE TABLE "test.gt_iceberg".gt_db2.tb03 (+CREATE TABLE gt_iceberg.gt_db2.tb03 (name varchar,salary int) with (@@ -33,46 +33,46 @@ CREATE TABLE "test.gt_iceberg".gt_db2.tb03 (sorted_by = ARRAY['name']);-show create table "test.gt_iceberg".gt_db2.tb03;+show create table gt_iceberg.gt_db2.tb03;-CREATE TABLE "test.gt_iceberg".gt_db2.tb04 (+CREATE TABLE gt_iceberg.gt_db2.tb04 (name varchar,salary int) with (sorted_by = ARRAY['name']);-show create table "test.gt_iceberg".gt_db2.tb04;+show create table gt_iceberg.gt_db2.tb04;-CREATE TABLE "test.gt_iceberg".gt_db2.tb05 (+CREATE TABLE gt_iceberg.gt_db2.tb05 (name varchar,salary int) with (partitioning = ARRAY['name']);-show create table "test.gt_iceberg".gt_db2.tb05;+show create table gt_iceberg.gt_db2.tb05;-CREATE TABLE "test.gt_iceberg".gt_db2.tb06 (+CREATE TABLE gt_iceberg.gt_db2.tb06 (name varchar,salary int) with (location = '${hdfs_uri}/user/iceberg/warehouse/TrinoQueryIT/gt_iceberg/gt_db2/tb06');-show create table "test.gt_iceberg".gt_db2.tb06;+show create table gt_iceberg.gt_db2.tb06;-drop table "test.gt_iceberg".gt_db2.tb01;+drop table gt_iceberg.gt_db2.tb01;-drop table "test.gt_iceberg".gt_db2.tb02;+drop table gt_iceberg.gt_db2.tb02;-drop table "test.gt_iceberg".gt_db2.tb03;+drop table gt_iceberg.gt_db2.tb03;-drop table "test.gt_iceberg".gt_db2.tb04;+drop table gt_iceberg.gt_db2.tb04;-drop table "test.gt_iceberg".gt_db2.tb05;+drop table gt_iceberg.gt_db2.tb05;-drop table "test.gt_iceberg".gt_db2.tb06;+drop table gt_iceberg.gt_db2.tb06;-drop schema "test.gt_iceberg".gt_db2;\ No newline at end of file+drop schema gt_iceberg.gt_db2;\ No newline at end of filediff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00000_create_table.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00000_create_table.txtindex a8fd39e340..c0ba8a4044 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00000_create_table.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00000_create_table.txt@@ -2,7 +2,7 @@ CREATE SCHEMACREATE TABLE-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb01 (+"CREATE TABLE gt_iceberg.gt_db2.tb01 (name varchar,salary integer)@@ -10,7 +10,7 @@ COMMENT ''"CREATE TABLE-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb02 (+"CREATE TABLE gt_iceberg.gt_db2.tb02 (name varchar,salary integer)@@ -24,7 +24,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb03 (+"CREATE TABLE gt_iceberg.gt_db2.tb03 (name varchar,salary integer)@@ -36,7 +36,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb04 (+"CREATE TABLE gt_iceberg.gt_db2.tb04 (name varchar,salary integer)@@ -47,7 +47,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb05 (+"CREATE TABLE gt_iceberg.gt_db2.tb05 (name varchar,salary integer)@@ -58,7 +58,7 @@ WITH (CREATE TABLE-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb06 (+"CREATE TABLE gt_iceberg.gt_db2.tb06 (name varchar,salary integer)diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00001_select_table.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00001_select_table.sqlindex 9ec231fd16..16c2b23ee2 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00001_select_table.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00001_select_table.sql@@ -1,28 +1,28 @@-CREATE SCHEMA "test.gt_iceberg".gt_db2;+CREATE SCHEMA gt_iceberg.gt_db2;-CREATE TABLE "test.gt_iceberg".gt_db2.tb01 (+CREATE TABLE gt_iceberg.gt_db2.tb01 (name varchar,salary int);-insert into "test.gt_iceberg".gt_db2.tb01(name, salary) values ('sam', 11);-insert into "test.gt_iceberg".gt_db2.tb01(name, salary) values ('jerry', 13);-insert into "test.gt_iceberg".gt_db2.tb01(name, salary) values ('bob', 14), ('tom', 12);+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);-select * from "test.gt_iceberg".gt_db2.tb01 order by name;+select * from gt_iceberg.gt_db2.tb01 order by name;-CREATE TABLE "test.gt_iceberg".gt_db2.tb02 (+CREATE TABLE gt_iceberg.gt_db2.tb02 (name varchar,salary int);-insert into "test.gt_iceberg".gt_db2.tb02(name, salary) select distinct * from "test.gt_iceberg".gt_db2.tb01 order by name;+insert into gt_iceberg.gt_db2.tb02(name, salary) select * from gt_iceberg.gt_db2.tb01 order by name;-select * from "test.gt_iceberg".gt_db2.tb02 order by name;+select * from gt_iceberg.gt_db2.tb02 order by name;-drop table "test.gt_iceberg".gt_db2.tb02;+drop table gt_iceberg.gt_db2.tb02;-drop table "test.gt_iceberg".gt_db2.tb01;+drop table gt_iceberg.gt_db2.tb01;-drop schema "test.gt_iceberg".gt_db2;+drop schema gt_iceberg.gt_db2;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00002_alter_table.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00002_alter_table.sqlindex 3450a23a2d..b31831e357 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00002_alter_table.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00002_alter_table.sql@@ -1,35 +1,35 @@-CREATE SCHEMA "test.gt_iceberg".gt_db2;+CREATE SCHEMA gt_iceberg.gt_db2;-CREATE TABLE "test.gt_iceberg".gt_db2.tb01 (+CREATE TABLE gt_iceberg.gt_db2.tb01 (name varchar,salary int,city int);-alter table "test.gt_iceberg".gt_db2.tb01 rename to "test.gt_iceberg".gt_db2.tb03;-show tables from "test.gt_iceberg".gt_db2;+alter table gt_iceberg.gt_db2.tb01 rename to gt_iceberg.gt_db2.tb03;+show tables from gt_iceberg.gt_db2;-alter table "test.gt_iceberg".gt_db2.tb03 rename to "test.gt_iceberg".gt_db2.tb01;-show tables from "test.gt_iceberg".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 "test.gt_iceberg".gt_db2.tb01 drop column city;-show create table "test.gt_iceberg".gt_db2.tb01;+alter table gt_iceberg.gt_db2.tb01 drop column city;+show create table gt_iceberg.gt_db2.tb01;-alter table "test.gt_iceberg".gt_db2.tb01 rename column name to s;-show create table "test.gt_iceberg".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 "test.gt_iceberg".gt_db2.tb01 alter column salary set data type bigint;-show create table "test.gt_iceberg".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;-comment on table "test.gt_iceberg".gt_db2.tb01 is 'test table comments';-show create table "test.gt_iceberg".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 column "test.gt_iceberg".gt_db2.tb01.s is 'test column comments';-show create table "test.gt_iceberg".gt_db2.tb01;+comment on column gt_iceberg.gt_db2.tb01.s is 'test column comments';+show create table gt_iceberg.gt_db2.tb01;-alter table "test.gt_iceberg".gt_db2.tb01 add column city varchar comment 'aaa';-show create table "test.gt_iceberg".gt_db2.tb01;+alter table gt_iceberg.gt_db2.tb01 add column city varchar comment 'aaa';+show create table gt_iceberg.gt_db2.tb01;-drop table "test.gt_iceberg".gt_db2.tb01;+drop table gt_iceberg.gt_db2.tb01;-drop schema "test.gt_iceberg".gt_db2;+drop schema gt_iceberg.gt_db2;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00002_alter_table.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00002_alter_table.txtindex e979156e51..969d40b0eb 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00002_alter_table.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00002_alter_table.txt@@ -12,7 +12,7 @@ RENAME TABLEDROP COLUMN-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb01 (+"CREATE TABLE gt_iceberg.gt_db2.tb01 (name varchar,salary integer)@@ -20,7 +20,7 @@ COMMENT ''"RENAME COLUMN-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb01 (+"CREATE TABLE gt_iceberg.gt_db2.tb01 (s varchar,salary integer)@@ -28,7 +28,7 @@ COMMENT ''"SET COLUMN TYPE-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb01 (+"CREATE TABLE gt_iceberg.gt_db2.tb01 (s varchar,salary bigint)@@ -36,7 +36,7 @@ COMMENT ''"COMMENT-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb01 (+"CREATE TABLE gt_iceberg.gt_db2.tb01 (s varchar,salary bigint)@@ -44,7 +44,7 @@ COMMENT 'test table comments'"COMMENT-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb01 (+"CREATE TABLE gt_iceberg.gt_db2.tb01 (s varchar COMMENT 'test column comments',salary bigint)@@ -52,7 +52,7 @@ COMMENT 'test table comments'"ADD COLUMN-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb01 (+"CREATE TABLE gt_iceberg.gt_db2.tb01 (s varchar COMMENT 'test column comments',salary bigint,city varchar COMMENT 'aaa'diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00006_datatype.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00006_datatype.sqlindex c3d7890550..7285458880 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00006_datatype.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00006_datatype.sql@@ -1,6 +1,6 @@-CREATE SCHEMA "test.gt_iceberg".gt_db2;+CREATE SCHEMA gt_iceberg.gt_db2;-USE "test.gt_iceberg".gt_db2;+USE gt_iceberg.gt_db2;-- Unsupported Type: TINYINT, SMALLINTCREATE TABLE tb01 (@@ -64,4 +64,4 @@ drop table tb01;drop table tb02;-drop schema "test.gt_iceberg".gt_db2;+drop schema gt_iceberg.gt_db2;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00006_datatype.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00006_datatype.txtindex 8ff0979aa9..915539adaf 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00006_datatype.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00006_datatype.txt@@ -4,7 +4,7 @@ USECREATE TABLE-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb01 (+"CREATE TABLE gt_iceberg.gt_db2.tb01 (f1 varchar,f3 varbinary,f4 decimal(10, 3),@@ -30,7 +30,7 @@ INSERT: 1 rowCREATE TABLE-"CREATE TABLE ""test.gt_iceberg"".gt_db2.tb02 (+"CREATE TABLE gt_iceberg.gt_db2.tb02 (f1 varchar NOT NULL,f3 varbinary NOT NULL,f4 decimal(10, 3) NOT NULL,diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00007_varchar.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00007_varchar.sqlindex 3e19bf5a15..ab17351747 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00007_varchar.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00007_varchar.sql@@ -1,6 +1,6 @@-CREATE SCHEMA "test.gt_iceberg".varchar_db2;+CREATE SCHEMA gt_iceberg.varchar_db2;-USE "test.gt_iceberg".varchar_db2;+USE gt_iceberg.varchar_db2;CREATE TABLE tb01 (id int, name char(20));@@ -10,9 +10,9 @@ CREATE TABLE tb03 (id int, name varchar(233));CREATE TABLE tb04 (id int, name varchar);-SHOW CREATE TABLE "test.gt_iceberg".varchar_db2.tb04;+SHOW CREATE TABLE gt_iceberg.varchar_db2.tb04;-drop table "test.gt_iceberg".varchar_db2.tb04;+drop table gt_iceberg.varchar_db2.tb04;-drop schema "test.gt_iceberg".varchar_db2;+drop schema gt_iceberg.varchar_db2;diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00007_varchar.txt b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00007_varchar.txtindex 58e38b89f4..c7f7ab14e4 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00007_varchar.txt+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00007_varchar.txt@@ -10,7 +10,7 @@ USECREATE TABLE-"CREATE TABLE ""test.gt_iceberg"".varchar_db2.tb04 (+"CREATE TABLE gt_iceberg.varchar_db2.tb04 (id integer,name varchar)diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/tpcds/catalog_mysql_prepare.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/tpcds/catalog_mysql_prepare.sqlindex 81ca5c1465..86bd2f72a6 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/tpcds/catalog_mysql_prepare.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/tpcds/catalog_mysql_prepare.sql@@ -9,8 +9,8 @@ call gravitino.system.create_catalog(show catalogs;-create schema "test.gt_mysql1".gt_tpcds;-use "test.gt_mysql1".gt_tpcds;+create schema gt_mysql1.gt_tpcds;+use gt_mysql1.gt_tpcds;CREATE TABLE call_center (cc_call_center_sk bigint,diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_hive_prepare.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_hive_prepare.sqlindex cc015bccbd..2fb4294af7 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_hive_prepare.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_hive_prepare.sql@@ -7,8 +7,8 @@ call gravitino.system.create_catalog());-create schema "test.gt_hive2".gt_tpch;-use "test.gt_hive2".gt_tpch;+create schema gt_hive2.gt_tpch;+use gt_hive2.gt_tpch;CREATE TABLE customer (custkey bigint,diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_iceberg_prepare.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_iceberg_prepare.sqlindex dfd439612d..a5a0669f83 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_iceberg_prepare.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_iceberg_prepare.sql@@ -7,8 +7,8 @@ call gravitino.system.create_catalog());-create schema "test.gt_iceberg2".gt_tpch2;-use "test.gt_iceberg2".gt_tpch2;+create schema gt_iceberg2.gt_tpch2;+use gt_iceberg2.gt_tpch2;CREATE TABLE customer (custkey bigint,diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_mysql_prepare.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_mysql_prepare.sqlindex 3376ab8297..5f42569f2f 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_mysql_prepare.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_mysql_prepare.sql@@ -7,8 +7,8 @@ call gravitino.system.create_catalog());-create schema "test.gt_mysql2".gt_tpch;-use "test.gt_mysql2".gt_tpch;+create schema gt_mysql2.gt_tpch;+use gt_mysql2.gt_tpch;CREATE TABLE customer (custkey bigint NOT NULL,diff --git a/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_postgresql_prepare.sql b/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_postgresql_prepare.sqlindex d4b8444a01..bacbc98ea0 100644--- a/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_postgresql_prepare.sql+++ b/integration-test/src/test/resources/trino-ci-testset/testsets/tpch/catalog_postgresql_prepare.sql@@ -7,8 +7,8 @@ call gravitino.system.create_catalog());-create schema "test.gt_postgresql2".gt_tpch;-use "test.gt_postgresql2".gt_tpch;+create schema gt_postgresql2.gt_tpch;+use gt_postgresql2.gt_tpch;CREATE TABLE customer (custkey bigint NOT NULL,diff --git a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoConfig.java b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoConfig.javaindex 63b68bb162..978e8d1f54 100644--- a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoConfig.java+++ b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoConfig.java@@ -28,7 +28,7 @@ public class GravitinoConfig {new ConfigEntry("gravitino.simplify-catalog-names","Omit metalake prefix for catalog names",- "false",+ "true",false);public GravitinoConfig(Map<String, String> requiredConfig) {diff --git a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoConnectorFactory.java b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoConnectorFactory.javaindex 1c7a43f09f..84f84ec266 100644--- a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoConnectorFactory.java+++ b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/GravitinoConnectorFactory.java@@ -64,8 +64,7 @@ public class GravitinoConnectorFactory implements ConnectorFactory {try {CatalogInjector catalogInjector = new CatalogInjector();catalogInjector.init(context);- CatalogConnectorFactory catalogConnectorFactory =- new CatalogConnectorFactory(catalogInjector);+ CatalogConnectorFactory catalogConnectorFactory = new CatalogConnectorFactory();catalogConnectorManager =new CatalogConnectorManager(catalogInjector, catalogConnectorFactory);@@ -95,7 +94,7 @@ public class GravitinoConnectorFactory implements ConnectorFactory {if (Strings.isNullOrEmpty(metalake)) {throw new TrinoException(GRAVITINO_METALAKE_NOT_EXISTS, "No gravitino metalake selected");}- if (config.simplifyCatalogNames() && catalogConnectorManager.getCatalogs().size() > 1) {+ if (config.simplifyCatalogNames() && !catalogConnectorManager.getUsedMetalakes().isEmpty()) {throw new TrinoException(GRAVITINO_MISSING_CONFIG,"Multiple metalakes are not supported when setting gravitino.simplify-catalog-names = true");diff --git a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/CatalogConnectorFactory.java b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/CatalogConnectorFactory.javaindex ad141b6386..1b8ab56924 100644--- a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/CatalogConnectorFactory.java+++ b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/CatalogConnectorFactory.java@@ -4,10 +4,8 @@*/package com.datastrato.gravitino.trino.connector.catalog;-import static com.datastrato.gravitino.trino.connector.GravitinoErrorCode.GRAVITINO_CREATE_INTERNAL_CONNECTOR_ERROR;import static com.datastrato.gravitino.trino.connector.GravitinoErrorCode.GRAVITINO_UNSUPPORTED_CATALOG_PROVIDER;-import com.datastrato.gravitino.client.GravitinoMetalake;import com.datastrato.gravitino.trino.connector.catalog.hive.HiveConnectorAdapter;import com.datastrato.gravitino.trino.connector.catalog.iceberg.IcebergConnectorAdapter;import com.datastrato.gravitino.trino.connector.catalog.jdbc.mysql.MySQLConnectorAdapter;@@ -15,7 +13,6 @@ import com.datastrato.gravitino.trino.connector.catalog.jdbc.postgresql.PostgreSimport com.datastrato.gravitino.trino.connector.catalog.memory.MemoryConnectorAdapter;import com.datastrato.gravitino.trino.connector.metadata.GravitinoCatalog;import io.trino.spi.TrinoException;-import io.trino.spi.connector.Connector;import java.util.HashMap;import org.slf4j.Logger;import org.slf4j.LoggerFactory;@@ -24,12 +21,9 @@ import org.slf4j.LoggerFactory;public class CatalogConnectorFactory {private static final Logger LOG = LoggerFactory.getLogger(CatalogConnectorFactory.class);- private final CatalogInjector catalogInjector;private final HashMap<String, CatalogConnectorContext.Builder> catalogBuilders = new HashMap<>();- public CatalogConnectorFactory(CatalogInjector catalogInjector) {- this.catalogInjector = catalogInjector;-+ public CatalogConnectorFactory() {catalogBuilders.put("hive", new CatalogConnectorContext.Builder(new HiveConnectorAdapter()));catalogBuilders.put("memory", new CatalogConnectorContext.Builder(new MemoryConnectorAdapter()));@@ -41,8 +35,8 @@ public class CatalogConnectorFactory {"jdbc-postgresql", new CatalogConnectorContext.Builder(new PostgreSQLConnectorAdapter()));}- public CatalogConnectorContext loadCatalogConnector(- GravitinoMetalake metalake, GravitinoCatalog catalog) {+ public CatalogConnectorContext.Builder createCatalogConnectorContextBuilder(+ GravitinoCatalog catalog) {String catalogProvider = catalog.getProvider();CatalogConnectorContext.Builder builder = catalogBuilders.get(catalogProvider);if (builder == null) {@@ -52,23 +46,6 @@ public class CatalogConnectorFactory {}// Avoid using the same builder object to prevent catalog creation errors.- builder = builder.clone();-- try {- Connector internalConnector =- catalogInjector.createConnector(catalog.getFullName(), builder.buildConfig(catalog));-- return builder- .withMetalake(metalake)- .withCatalog(catalog)- .withInternalConnector(internalConnector)- .build();-- } catch (Exception e) {- String message =- String.format("Failed to create internal catalog connector. The catalog is: %s", catalog);- LOG.error(message, e);- throw new TrinoException(GRAVITINO_CREATE_INTERNAL_CONNECTOR_ERROR, message, e);- }+ return builder.clone();}}diff --git a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/CatalogConnectorManager.java b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/CatalogConnectorManager.javaindex 9ba6fefeb7..ac1da69bfb 100644--- a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/CatalogConnectorManager.java+++ b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/CatalogConnectorManager.java@@ -6,8 +6,10 @@ package com.datastrato.gravitino.trino.connector.catalog;import static com.datastrato.gravitino.trino.connector.GravitinoErrorCode.GRAVITINO_CATALOG_ALREADY_EXISTS;import static com.datastrato.gravitino.trino.connector.GravitinoErrorCode.GRAVITINO_CATALOG_NOT_EXISTS;+import static com.datastrato.gravitino.trino.connector.GravitinoErrorCode.GRAVITINO_CREATE_INTERNAL_CONNECTOR_ERROR;import static com.datastrato.gravitino.trino.connector.GravitinoErrorCode.GRAVITINO_METALAKE_NOT_EXISTS;import static com.datastrato.gravitino.trino.connector.GravitinoErrorCode.GRAVITINO_MISSING_CONFIG;+import static com.datastrato.gravitino.trino.connector.GravitinoErrorCode.GRAVITINO_OPERATION_FAILED;import static com.datastrato.gravitino.trino.connector.GravitinoErrorCode.GRAVITINO_UNSUPPORTED_OPERATION;import com.datastrato.gravitino.Catalog;@@ -25,6 +27,7 @@ import com.google.common.annotations.VisibleForTesting;import com.google.common.base.Preconditions;import com.google.common.util.concurrent.ThreadFactoryBuilder;import io.trino.spi.TrinoException;+import io.trino.spi.connector.Connector;import java.util.ArrayList;import java.util.Arrays;import java.util.HashSet;@@ -166,7 +169,7 @@ public class CatalogConnectorManager {Catalog catalog = metalake.loadCatalog(nameIdentifier);GravitinoCatalog gravitinoCatalog =new GravitinoCatalog(metalake.name(), catalog, config.simplifyCatalogNames());- if (catalogConnectors.containsKey(gravitinoCatalog.getFullName())) {+ if (catalogConnectors.containsKey(getTrinoCatalogName(gravitinoCatalog))) {// Reload catalogs that have been updated in Gravitino server.reloadCatalog(metalake, gravitinoCatalog);@@ -183,13 +186,13 @@ public class CatalogConnectorManager {}private void reloadCatalog(GravitinoMetalake metalake, GravitinoCatalog catalog) {- GravitinoCatalog oldCatalog = catalogConnectors.get(catalog.getFullName()).getCatalog();+ GravitinoCatalog oldCatalog = catalogConnectors.get(getTrinoCatalogName(catalog)).getCatalog();if (!catalog.getLastModifiedTime().isAfter(oldCatalog.getLastModifiedTime())) {return;}- catalogInjector.removeCatalogConnector(catalog.getFullName());- catalogConnectors.remove(catalog.getFullName());+ catalogInjector.removeCatalogConnector((getTrinoCatalogName(catalog)));+ catalogConnectors.remove(getTrinoCatalogName(catalog));loadCatalogImpl(metalake, catalog);LOG.info("Update catalog '{}' in metalake {} successfully.", catalog, metalake.name());@@ -197,16 +200,27 @@ public class CatalogConnectorManager {private void loadCatalog(GravitinoMetalake metalake, GravitinoCatalog catalog) {loadCatalogImpl(metalake, catalog);- LOG.info(- "Load catalog {} in metalake {} successfully.", catalog.getFullName(), metalake.name());+ LOG.info("Load catalog {} in metalake {} successfully.", catalog, metalake.name());}private void loadCatalogImpl(GravitinoMetalake metalake, GravitinoCatalog catalog) {- CatalogConnectorContext catalogConnectorContext =- catalogConnectorFactory.loadCatalogConnector(metalake, catalog);+ CatalogConnectorContext.Builder builder =+ catalogConnectorFactory.createCatalogConnectorContextBuilder(catalog);+ try {+ Connector internalConnector =+ catalogInjector.createConnector(+ getTrinoCatalogName(catalog), builder.buildConfig(catalog));- catalogConnectors.put(catalog.getFullName(), catalogConnectorContext);- catalogInjector.injectCatalogConnector(catalog.getFullName());+ builder.withMetalake(metalake).withCatalog(catalog).withInternalConnector(internalConnector);+ } catch (Exception e) {+ String message =+ String.format("Failed to create internal catalog connector. The catalog is: %s", catalog);+ LOG.error(message, e);+ throw new TrinoException(GRAVITINO_CREATE_INTERNAL_CONNECTOR_ERROR, message, e);+ }++ catalogConnectors.put(getTrinoCatalogName(catalog), builder.build());+ catalogInjector.injectCatalogConnector(getTrinoCatalogName(catalog));}private void unloadCatalog(GravitinoMetalake metalake, String catalogFullName) {@@ -228,6 +242,14 @@ public class CatalogConnectorManager {throw new NotImplementedException();}+ public String getTrinoCatalogName(String metalake, String catalog) {+ return config.simplifyCatalogNames() ? catalog : metalake + "." + catalog;+ }++ public String getTrinoCatalogName(GravitinoCatalog catalog) {+ return getTrinoCatalogName(catalog.getMetalake(), catalog.getName());+ }+public void createCatalog(String metalakeName,String catalogName,@@ -235,7 +257,7 @@ public class CatalogConnectorManager {Map<String, String> properties,boolean ignoreExist) {NameIdentifier catalog = NameIdentifier.of(metalakeName, catalogName);- if (catalogConnectors.containsKey(catalog.toString())) {+ if (catalogConnectors.containsKey(getTrinoCatalogName(metalakeName, catalogName))) {if (!ignoreExist) {throw new TrinoException(GRAVITINO_CATALOG_ALREADY_EXISTS, String.format("Catalog %s already exists.", catalog));@@ -249,11 +271,15 @@ public class CatalogConnectorManager {metalake.createCatalog(catalog, Catalog.Type.RELATIONAL, provider, "Trino created", properties);- LOG.info("Create catalog {} in metalake {} successfully.", catalog, metalake);+ LOG.info("Create catalog {} in metalake {} successfully.", catalogName, metalake);Future<?> future = executorService.submit(this::loadMetalake);future.get(30, TimeUnit.SECONDS);+ if (!catalogConnectors.containsKey(getTrinoCatalogName(metalakeName, catalogName))) {+ throw new TrinoException(+ GRAVITINO_OPERATION_FAILED, "Create catalog failed due to the loading process fails");+ }} catch (NoSuchMetalakeException e) {throw new TrinoException(GRAVITINO_METALAKE_NOT_EXISTS, "Metalake " + metalakeName + " not exists.");@@ -286,11 +312,15 @@ public class CatalogConnectorManager {throw new TrinoException(GRAVITINO_UNSUPPORTED_OPERATION, "Drop catalog " + catalog + " does not support.");}- LOG.info("Drop catalog {} in metalake {} successfully.", catalog, metalake);+ LOG.info("Drop catalog {} in metalake {} successfully.", catalogName, metalake);Future<?> future = executorService.submit(this::loadMetalake);future.get(30, TimeUnit.SECONDS);+ if (catalogConnectors.containsKey(getTrinoCatalogName(metalakeName, catalogName))) {+ throw new TrinoException(+ GRAVITINO_OPERATION_FAILED, "Drop catalog failed due to the reloading process fails");+ }} catch (NoSuchMetalakeException e) {throw new TrinoException(GRAVITINO_METALAKE_NOT_EXISTS, "Metalake " + metalakeName + " not exists.");@@ -305,10 +335,10 @@ public class CatalogConnectorManager {String catalogName,Map<String, String> setProperties,List<String> removeProperties) {+ NameIdentifier catalog = NameIdentifier.of(metalakeName, catalogName);try {- NameIdentifier catalogNameId = NameIdentifier.of(metalakeName, catalogName);CatalogConnectorContext catalogConnectorContext =- catalogConnectors.get(catalogNameId.toString());+ catalogConnectors.get(getTrinoCatalogName(metalakeName, catalogName));GravitinoCatalog oldCatalog = catalogConnectorContext.getCatalog();List<CatalogChange> changes = new ArrayList<>();@@ -341,19 +371,27 @@ public class CatalogConnectorManager {GravitinoMetalake metalake =gravitinoClient.loadMetalake(NameIdentifier.ofMetalake(metalakeName));- metalake.alterCatalog(- NameIdentifier.of(metalakeName, catalogName),- changes.toArray(changes.toArray(new CatalogChange[0])));+ metalake.alterCatalog(catalog, changes.toArray(changes.toArray(new CatalogChange[0])));Future<?> future = executorService.submit(this::loadMetalake);future.get(30, TimeUnit.SECONDS);+ catalogConnectorContext =+ catalogConnectors.get(getTrinoCatalogName(metalakeName, catalogName));+ if (catalogConnectorContext == null+ || catalogConnectorContext+ .getCatalog()+ .getLastModifiedTime()+ .equals(oldCatalog.getLastModifiedTime())) {+ throw new TrinoException(+ GRAVITINO_OPERATION_FAILED, "Update catalog failed due to the reloading process fails");+ }+} catch (NoSuchMetalakeException e) {throw new TrinoException(GRAVITINO_METALAKE_NOT_EXISTS, "Metalake " + metalakeName + " not exists.");} catch (NoSuchCatalogException e) {- throw new TrinoException(- GRAVITINO_CATALOG_NOT_EXISTS, "Catalog " + catalogName + " not exists.");+ throw new TrinoException(GRAVITINO_CATALOG_NOT_EXISTS, "Catalog " + catalog + " not exists.");} catch (Exception e) {throw new TrinoException(GRAVITINO_UNSUPPORTED_OPERATION, "alter catalog failed. " + e.getMessage(), e);@@ -367,4 +405,8 @@ public class CatalogConnectorManager {"Multiple metalakes are not supported when setting gravitino.simplify-catalog-names = true");usedMetalakes.add(metalake);}++ public Set<String> getUsedMetalakes() {+ return usedMetalakes;+ }}diff --git a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/metadata/GravitinoCatalog.java b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/metadata/GravitinoCatalog.javaindex 19c2fc8165..4dd61b1c36 100644--- a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/metadata/GravitinoCatalog.java+++ b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/metadata/GravitinoCatalog.java@@ -18,12 +18,10 @@ public class GravitinoCatalog {private final String metalake;private final Catalog catalog;- private final boolean usingSimpleName;public GravitinoCatalog(String metalake, Catalog catalog, boolean usingSimpleName) {this.metalake = metalake;this.catalog = catalog;- this.usingSimpleName = usingSimpleName;}public String getProvider() {@@ -34,8 +32,8 @@ public class GravitinoCatalog {return catalog.name();}- public String getFullName() {- return usingSimpleName ? catalog.name() : metalake + "." + catalog.name();+ public String getMetalake() {+ return metalake;}public NameIdentifier geNameIdentifier() {diff --git a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/system/table/GravitinoSystemTableCatalog.java b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/system/table/GravitinoSystemTableCatalog.javaindex 2996f8a968..63db9900ed 100644--- a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/system/table/GravitinoSystemTableCatalog.java+++ b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/system/table/GravitinoSystemTableCatalog.java@@ -52,7 +52,7 @@ public class GravitinoSystemTableCatalog extends GravitinoSystemTable {for (GravitinoCatalog catalog : catalogs) {Preconditions.checkNotNull(catalog, "catalog should not be null");- VARCHAR.writeString(nameColumnBuilder, catalog.getFullName());+ VARCHAR.writeString(nameColumnBuilder, catalog.getName());VARCHAR.writeString(providerColumnBuilder, catalog.getProvider());try {VARCHAR.writeString(diff --git a/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/GravitinoMockServer.java b/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/GravitinoMockServer.javaindex 0b10579dcf..66d1fa9821 100644--- a/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/GravitinoMockServer.java+++ b/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/GravitinoMockServer.java@@ -65,10 +65,6 @@ public class GravitinoMockServer implements AutoCloseable {CatalogConnectorManager catalogConnectorManager;private GeneralDataTypeTransformer dataTypeTransformer = new HiveDataTypeTransformer();- public GravitinoMockServer() {- this(false);- }-public GravitinoMockServer(boolean simpleCatalogName) {this.simpleCatalogName = simpleCatalogName;createMetalake(NameIdentifier.ofMetalake(testMetalake));@@ -241,12 +237,13 @@ public class GravitinoMockServer implements AutoCloseable {MemoryConnector memoryConnector =(MemoryConnector)catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(+ catalogConnectorManager.getTrinoCatalogName(catalog)).getInternalConnector();ConnectorMetadata metadata = memoryConnector.getMetadata(null, null);catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(catalogConnectorManager.getTrinoCatalogName(catalog)).getMetadataAdapter();GravitinoSchema schema = new GravitinoSchema(schemaName.name(), properties, "");metadata.createSchema(null, schemaName.name(), emptyMap(), null);@@ -269,7 +266,8 @@ public class GravitinoMockServer implements AutoCloseable {MemoryConnector memoryConnector =(MemoryConnector)catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(+ catalogConnectorManager.getTrinoCatalogName(catalog)).getInternalConnector();ConnectorMetadata metadata = memoryConnector.getMetadata(null, null);metadata.dropSchema(null, nameIdentifier.name(), cascade);@@ -286,7 +284,8 @@ public class GravitinoMockServer implements AutoCloseable {MemoryConnector memoryConnector =(MemoryConnector)catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(+ catalogConnectorManager.getTrinoCatalogName(catalog)).getInternalConnector();ConnectorMetadata metadata = memoryConnector.getMetadata(null, null);return metadata.listSchemaNames(null).stream()@@ -307,7 +306,8 @@ public class GravitinoMockServer implements AutoCloseable {MemoryConnector memoryConnector =(MemoryConnector)catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(+ catalogConnectorManager.getTrinoCatalogName(catalog)).getInternalConnector();memoryConnector.getMetadata(null, null);ConnectorMetadata metadata = memoryConnector.getMetadata(null, null);@@ -316,7 +316,7 @@ public class GravitinoMockServer implements AutoCloseable {CatalogConnectorMetadataAdapter metadataAdapter =catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(catalogConnectorManager.getTrinoCatalogName(catalog)).getMetadataAdapter();GravitinoSchema gravitinoSchema =@@ -361,7 +361,7 @@ public class GravitinoMockServer implements AutoCloseable {tableName.schema(), tableName.table(), columns, comment, properties);CatalogConnectorMetadataAdapter metadataAdapter =catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(catalogConnectorManager.getTrinoCatalogName(catalog)).getMetadataAdapter();ConnectorTableMetadata tableMetadata =metadataAdapter.getTableMetadata(gravitinoTable);@@ -369,7 +369,8 @@ public class GravitinoMockServer implements AutoCloseable {MemoryConnector memoryConnector =(MemoryConnector)catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(+ catalogConnectorManager.getTrinoCatalogName(catalog)).getInternalConnector();ConnectorMetadata metadata = memoryConnector.getMetadata(null, null);metadata.createTable(null, tableMetadata, false);@@ -388,7 +389,8 @@ public class GravitinoMockServer implements AutoCloseable {MemoryConnector memoryConnector =(MemoryConnector)catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(+ catalogConnectorManager.getTrinoCatalogName(catalog)).getInternalConnector();memoryConnector.getMetadata(null, null);ConnectorMetadata metadata = memoryConnector.getMetadata(null, null);@@ -415,7 +417,8 @@ public class GravitinoMockServer implements AutoCloseable {MemoryConnector memoryConnector =(MemoryConnector)catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(+ catalogConnectorManager.getTrinoCatalogName(catalog)).getInternalConnector();ConnectorMetadata metadata = memoryConnector.getMetadata(null, null);ArrayList<NameIdentifier> tableNames = new ArrayList<>();@@ -441,7 +444,8 @@ public class GravitinoMockServer implements AutoCloseable {MemoryConnector memoryConnector =(MemoryConnector)catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(+ catalogConnectorManager.getTrinoCatalogName(catalog)).getInternalConnector();ConnectorMetadata metadata = memoryConnector.getMetadata(null, null);return metadata.getTableHandle(@@ -463,7 +467,8 @@ public class GravitinoMockServer implements AutoCloseable {MemoryConnector memoryConnector =(MemoryConnector)catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(+ catalogConnectorManager.getTrinoCatalogName(catalog)).getInternalConnector();ConnectorMetadata metadata = memoryConnector.getMetadata(null, null);@@ -477,7 +482,7 @@ public class GravitinoMockServer implements AutoCloseable {CatalogConnectorMetadataAdapter metadataAdapter =catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(catalogConnectorManager.getTrinoCatalogName(catalog)).getMetadataAdapter();GravitinoTable gravitinoTable = metadataAdapter.createTable(tableMetadata);@@ -505,7 +510,8 @@ public class GravitinoMockServer implements AutoCloseable {MemoryConnector memoryConnector =(MemoryConnector)catalogConnectorManager- .getCatalogConnector(catalog.getFullName())+ .getCatalogConnector(+ catalogConnectorManager.getTrinoCatalogName(catalog)).getInternalConnector();ConnectorMetadata metadata = memoryConnector.getMetadata(null, null);ConnectorTableHandle tableHandle =@@ -542,7 +548,9 @@ public class GravitinoMockServer implements AutoCloseable {GravitinoColumn column =new GravitinoColumn(fieldName, addColumn.getDataType(), -1, "", true);CatalogConnectorMetadataAdapter metadataAdapter =- catalogConnectorManager.getCatalogConnector(catalog.getFullName()).getMetadataAdapter();+ catalogConnectorManager+ .getCatalogConnector(catalogConnectorManager.getTrinoCatalogName(catalog))+ .getMetadataAdapter();metadata.addColumn(null, tableHandle, metadataAdapter.getColumnMetadata(column));} else if (tableChange instanceof TableChange.DeleteColumn) {diff --git a/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestCreateGravitinoConnector.java b/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestCreateGravitinoConnector.javaindex 5b7013b9b7..5f6aa37583 100644--- a/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestCreateGravitinoConnector.java+++ b/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestCreateGravitinoConnector.java@@ -19,7 +19,7 @@ public class TestCreateGravitinoConnector {GravitinoMockServer server;@Test- public void testCreateSimpleCatalogNameConnector() throws Exception {+ public void testCreateConnectorsWithEnableSimpleCatalog() throws Exception {server = new GravitinoMockServer(true);Session session = testSessionBuilder().setCatalog("gravitino").build();QueryRunner queryRunner = DistributedQueryRunner.builder(session).setNodeCount(1).build();@@ -28,6 +28,7 @@ public class TestCreateGravitinoConnector {TestGravitinoPlugin gravitinoPlugin = new TestGravitinoPlugin(gravitinoClient);queryRunner.installPlugin(gravitinoPlugin);+ // test create two connector and set gravitino.simplify-catalog-names = true{// create a gravitino connector named gravitino using metalake testHashMap<String, String> properties = new HashMap<>();@@ -42,6 +43,7 @@ public class TestCreateGravitinoConnector {HashMap<String, String> properties = new HashMap<>();properties.put("gravitino.metalake", "test1");properties.put("gravitino.uri", "http://127.0.0.1:8090");+ properties.put("gravitino.simplify-catalog-names", "true");try {queryRunner.createCatalog("test1", "gravitino", properties);} catch (Exception e) {@@ -51,4 +53,36 @@ public class TestCreateGravitinoConnector {server.close();}++ @Test+ public void testCreateConnectorsWithDisableSimpleCatalog() throws Exception {+ server = new GravitinoMockServer(false);+ Session session = testSessionBuilder().setCatalog("gravitino").build();+ QueryRunner queryRunner = DistributedQueryRunner.builder(session).setNodeCount(1).build();++ GravitinoAdminClient gravitinoClient = server.createGravitinoClient();+ TestGravitinoPlugin gravitinoPlugin = new TestGravitinoPlugin(gravitinoClient);+ queryRunner.installPlugin(gravitinoPlugin);++ // test create two connector and set gravitino.simplify-catalog-names = false+ {+ // create a gravitino connector named gravitino using metalake test+ HashMap<String, String> properties = new HashMap<>();+ properties.put("gravitino.metalake", "test");+ properties.put("gravitino.uri", "http://127.0.0.1:8090");+ properties.put("gravitino.simplify-catalog-names", "false");+ queryRunner.createCatalog("test0", "gravitino", properties);+ }++ {+ // Test failed to create catalog with different metalake+ HashMap<String, String> properties = new HashMap<>();+ properties.put("gravitino.metalake", "test1");+ properties.put("gravitino.uri", "http://127.0.0.1:8090");+ properties.put("gravitino.simplify-catalog-names", "false");+ queryRunner.createCatalog("test1", "gravitino", properties);+ }++ server.close();+ }}diff --git a/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestGravitinoConnector.java b/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestGravitinoConnector.javaindex c605490997..93fb75da8c 100644--- a/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestGravitinoConnector.java+++ b/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestGravitinoConnector.java@@ -9,7 +9,6 @@ import static java.lang.String.format;import static org.assertj.core.api.Assertions.assertThat;import static org.testng.Assert.assertEquals;-import com.datastrato.gravitino.NameIdentifier;import com.datastrato.gravitino.client.GravitinoAdminClient;import com.datastrato.gravitino.trino.connector.catalog.CatalogConnectorManager;import io.trino.Session;@@ -19,7 +18,6 @@ import io.trino.testing.DistributedQueryRunner;import io.trino.testing.MaterializedResult;import io.trino.testing.MaterializedRow;import io.trino.testing.QueryRunner;-import java.util.Collections;import java.util.HashMap;import java.util.List;import java.util.concurrent.TimeUnit;@@ -37,7 +35,7 @@ public class TestGravitinoConnector extends AbstractTestQueryFramework {@Overrideprotected QueryRunner createQueryRunner() throws Exception {- server = closeAfterClass(new GravitinoMockServer());+ server = closeAfterClass(new GravitinoMockServer(true));GravitinoAdminClient gravitinoClient = server.createGravitinoClient();Session session = testSessionBuilder().setCatalog("gravitino").build();@@ -50,21 +48,11 @@ public class TestGravitinoConnector extends AbstractTestQueryFramework {queryRunner.installPlugin(gravitinoPlugin);queryRunner.installPlugin(new MemoryPlugin());- {- // create a gravitino connector named gravitino using metalake test- HashMap<String, String> properties = new HashMap<>();- properties.put("gravitino.metalake", "test");- properties.put("gravitino.uri", "http://127.0.0.1:8090");- queryRunner.createCatalog("gravitino", "gravitino", properties);- }-- {- // create a gravitino connector named test1 using metalake test1- HashMap<String, String> properties = new HashMap<>();- properties.put("gravitino.metalake", "test1");- properties.put("gravitino.uri", "http://127.0.0.1:8090");- queryRunner.createCatalog("test1", "gravitino", properties);- }+ // create a gravitino connector named gravitino using metalake test+ HashMap<String, String> properties = new HashMap<>();+ properties.put("gravitino.metalake", "test");+ properties.put("gravitino.uri", "http://127.0.0.1:8090");+ queryRunner.createCatalog("gravitino", "gravitino", properties);CatalogConnectorManager catalogConnectorManager =gravitinoPlugin.getCatalogConnectorManager();@@ -82,14 +70,14 @@ public class TestGravitinoConnector extends AbstractTestQueryFramework {@Testpublic void testCreateSchema() {- String catalogName = "test.memory";+ String catalogName = "memory";String schemaName = "db_01";- String fullSchemaName = String.format("\"%s\".%s", catalogName, schemaName);- assertThat(computeActual("show schemas from \"test.memory\"").getOnlyColumnAsSet())+ String fullSchemaName = String.format("%s.%s", catalogName, schemaName);+ assertThat(computeActual("show schemas from " + catalogName).getOnlyColumnAsSet()).doesNotContain(schemaName);assertUpdate("create schema " + fullSchemaName);- assertThat(computeActual("show schemas from \"test.memory\"").getOnlyColumnAsSet())+ assertThat(computeActual("show schemas from \"memory\"").getOnlyColumnAsSet()).contains(schemaName);assertThat((String) computeScalar("show create schema " + fullSchemaName))@@ -108,7 +96,7 @@ public class TestGravitinoConnector extends AbstractTestQueryFramework {@Testpublic void testCreateTable() {- String fullSchemaName = "\"test.memory\".db_01";+ String fullSchemaName = "memory.db_01";String tableName = "tb_01";String fullTableName = fullSchemaName + "." + tableName;@@ -127,13 +115,13 @@ public class TestGravitinoConnector extends AbstractTestQueryFramework {.startsWith(format("CREATE TABLE %s", fullTableName));// cleanup- assertUpdate("drop table" + fullTableName);+ assertUpdate("drop table " + fullTableName);assertUpdate("drop schema " + fullSchemaName);}@Testpublic void testInsert() throws Exception {- String fullTableName = "\"test.memory\".db_01.tb_01";+ String fullTableName = "\"memory\".db_01.tb_01";createTestTable(fullTableName);// insert some data.assertUpdate(String.format("insert into %s (a, b) values ('ice', 12)", fullTableName), 1);@@ -152,8 +140,8 @@ public class TestGravitinoConnector extends AbstractTestQueryFramework {@Testpublic void testInsertIntoSelect() throws Exception {- String fullTableName1 = "\"test.memory\".db_01.tb_01";- String fullTableName2 = "\"test.memory\".db_01.tb_02";+ String fullTableName1 = "\"memory\".db_01.tb_01";+ String fullTableName2 = "\"memory\".db_01.tb_02";createTestTable(fullTableName1);createTestTable(fullTableName2);@@ -171,8 +159,8 @@ public class TestGravitinoConnector extends AbstractTestQueryFramework {@Testpublic void testAlterTable() throws Exception {- String fullTableName1 = "\"test.memory\".db_01.tb_01";- String fullTableName2 = "\"test.memory\".db_01.tb_02";+ String fullTableName1 = "\"memory\".db_01.tb_01";+ String fullTableName2 = "\"memory\".db_01.tb_02";createTestTable(fullTableName1);// test rename table@@ -223,35 +211,25 @@ public class TestGravitinoConnector extends AbstractTestQueryFramework {public void testCreateCatalog() throws Exception {// testing the catalogsassertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("gravitino");- assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("test1");- assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("test.memory");+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("memory");// testing the gravitino connector framework works.assertThat(computeActual("select * from system.jdbc.tables"));// test metalake named test. the connector name is gravitinoassertUpdate("call gravitino.system.create_catalog('memory1', 'memory', Map())");- assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("test.memory1");+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("memory1");assertUpdate("call gravitino.system.drop_catalog('memory1')");- assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).doesNotContain("test.memory1");+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).doesNotContain("memory1");assertUpdate("call gravitino.system.create_catalog("+ "catalog=>'memory1', provider=>'memory', properties => Map(array['max_ttl'], array['10']), ignore_exist => true)");- assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("test.memory1");+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("memory1");assertUpdate("call gravitino.system.drop_catalog(catalog => 'memory1', ignore_not_exist => true)");- assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).doesNotContain("test.memory1");-- // test metalake named test1. the connnector name is test1- GravitinoAdminClient gravitinoClient = server.createGravitinoClient();- gravitinoClient.createMetalake(NameIdentifier.ofMetalake("test1"), "", Collections.emptyMap());-- assertUpdate("call test1.system.create_catalog('memory1', 'memory', Map())");- assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("test1.memory1");- assertUpdate("call test1.system.drop_catalog('memory1')");- assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).doesNotContain("test1.memory1");+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).doesNotContain("memory1");}@Test@@ -260,7 +238,7 @@ public class TestGravitinoConnector extends AbstractTestQueryFramework {assertEquals(expectedResult.getRowCount(), 1);List<MaterializedRow> expectedRows = expectedResult.getMaterializedRows();MaterializedRow row = expectedRows.get(0);- assertEquals(row.getField(0), "test.memory");+ assertEquals(row.getField(0), "memory");assertEquals(row.getField(1), "memory");assertEquals(row.getField(2), "{\"max_ttl\":\"10\"}");}diff --git a/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestGravitinoConnectorWithMetalakeCatalogName.java b/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestGravitinoConnectorWithMetalakeCatalogName.javanew file mode 100644index 0000000000..ed9d4457a0--- /dev/null+++ b/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestGravitinoConnectorWithMetalakeCatalogName.java@@ -0,0 +1,149 @@+/*+ * Copyright 2023 Datastrato Pvt Ltd.+ * This software is licensed under the Apache License version 2.+ */+package com.datastrato.gravitino.trino.connector;++import static io.trino.testing.TestingSession.testSessionBuilder;+import static java.lang.String.format;+import static org.assertj.core.api.Assertions.assertThat;+import static org.testng.Assert.assertEquals;++import com.datastrato.gravitino.NameIdentifier;+import com.datastrato.gravitino.client.GravitinoAdminClient;+import com.datastrato.gravitino.trino.connector.catalog.CatalogConnectorManager;+import io.trino.Session;+import io.trino.plugin.memory.MemoryPlugin;+import io.trino.testing.AbstractTestQueryFramework;+import io.trino.testing.DistributedQueryRunner;+import io.trino.testing.MaterializedResult;+import io.trino.testing.MaterializedRow;+import io.trino.testing.QueryRunner;+import java.util.Collections;+import java.util.HashMap;+import java.util.List;+import java.util.concurrent.TimeUnit;+import org.testcontainers.shaded.org.awaitility.Awaitility;+import org.testng.annotations.Test;++public class TestGravitinoConnectorWithMetalakeCatalogName extends AbstractTestQueryFramework {++ GravitinoMockServer server;++ @Override+ protected QueryRunner createQueryRunner() throws Exception {+ server = closeAfterClass(new GravitinoMockServer(false));+ GravitinoAdminClient gravitinoClient = server.createGravitinoClient();++ Session session = testSessionBuilder().setCatalog("gravitino").build();+ QueryRunner queryRunner = null;+ try {+ queryRunner = DistributedQueryRunner.builder(session).setNodeCount(1).build();++ TestGravitinoPlugin gravitinoPlugin = new TestGravitinoPlugin(gravitinoClient);+ queryRunner.installPlugin(gravitinoPlugin);+ queryRunner.installPlugin(new MemoryPlugin());++ {+ // create a gravitino connector named gravitino using metalake test+ HashMap<String, String> properties = new HashMap<>();+ properties.put("gravitino.metalake", "test");+ properties.put("gravitino.uri", "http://127.0.0.1:8090");+ properties.put("gravitino.simplify-catalog-names", "false");+ queryRunner.createCatalog("gravitino", "gravitino", properties);+ }++ {+ // create a gravitino connector named test1 using metalake test1+ HashMap<String, String> properties = new HashMap<>();+ properties.put("gravitino.metalake", "test1");+ properties.put("gravitino.uri", "http://127.0.0.1:8090");+ properties.put("gravitino.simplify-catalog-names", "false");+ queryRunner.createCatalog("test1", "gravitino", properties);+ }++ CatalogConnectorManager catalogConnectorManager =+ gravitinoPlugin.getCatalogConnectorManager();+ server.setCatalogConnectorManager(catalogConnectorManager);+ // Wait for the catalog to be created. Wait for at least 30 seconds.+ Awaitility.await()+ .atMost(30, TimeUnit.SECONDS)+ .pollInterval(1, TimeUnit.SECONDS)+ .until(() -> !catalogConnectorManager.getCatalogs().isEmpty());+ } catch (Exception e) {+ throw new RuntimeException("Create query runner failed", e);+ }+ return queryRunner;+ }++ @Test+ public void testSystemTable() throws Exception {+ MaterializedResult expectedResult = computeActual("select * from gravitino.system.catalog");+ assertEquals(expectedResult.getRowCount(), 1);+ List<MaterializedRow> expectedRows = expectedResult.getMaterializedRows();+ MaterializedRow row = expectedRows.get(0);+ assertEquals(row.getField(0), "memory");+ assertEquals(row.getField(1), "memory");+ assertEquals(row.getField(2), "{\"max_ttl\":\"10\"}");+ }++ @Test+ public void testCreateCatalog() throws Exception {+ // testing the catalogs+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("gravitino");+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("test1");+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("test.memory");++ // testing the gravitino connector framework works.+ assertThat(computeActual("select * from system.jdbc.tables"));++ // test metalake named test. the connector name is gravitino+ assertUpdate("call gravitino.system.create_catalog('memory1', 'memory', Map())");+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("test.memory1");+ assertUpdate("call gravitino.system.drop_catalog('memory1')");+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).doesNotContain("test.memory1");++ assertUpdate(+ "call gravitino.system.create_catalog("+ + "catalog=>'memory1', provider=>'memory', properties => Map(array['max_ttl'], array['10']), ignore_exist => true)");+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("test.memory1");++ assertUpdate(+ "call gravitino.system.drop_catalog(catalog => 'memory1', ignore_not_exist => true)");+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).doesNotContain("test.memory1");++ // test metalake named test1. the connnector name is test1+ GravitinoAdminClient gravitinoClient = server.createGravitinoClient();+ gravitinoClient.createMetalake(NameIdentifier.ofMetalake("test1"), "", Collections.emptyMap());++ assertUpdate("call test1.system.create_catalog('memory1', 'memory', Map())");+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("test1.memory1");+ assertUpdate("call test1.system.drop_catalog('memory1')");+ assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).doesNotContain("test1.memory1");+ }++ @Test+ public void testCreateTable() {+ String fullSchemaName = "\"test.memory\".db_01";+ String tableName = "tb_01";+ String fullTableName = fullSchemaName + "." + tableName;++ assertUpdate("create schema " + fullSchemaName);++ // try to get table+ assertThat(computeActual("show tables from " + fullSchemaName).getOnlyColumnAsSet())+ .doesNotContain(tableName);++ // try to create table+ assertUpdate("create table " + fullTableName + " (a varchar, b int)");+ assertThat(computeActual("show tables from " + fullSchemaName).getOnlyColumnAsSet())+ .contains(tableName);++ assertThat((String) computeScalar("show create table " + fullTableName))+ .startsWith(format("CREATE TABLE %s", fullTableName));++ // cleanup+ assertUpdate("drop table " + fullTableName);+ assertUpdate("drop schema " + fullSchemaName);+ }+}diff --git a/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestGravitinoConnectorWithSimpleCatalogName.java b/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestGravitinoConnectorWithSimpleCatalogName.javadeleted file mode 100644index 573816701d..0000000000--- a/trino-connector/src/test/java/com/datastrato/gravitino/trino/connector/TestGravitinoConnectorWithSimpleCatalogName.java+++ /dev/null@@ -1,92 +0,0 @@-/*- * Copyright 2023 Datastrato Pvt Ltd.- * This software is licensed under the Apache License version 2.- */-package com.datastrato.gravitino.trino.connector;--import static io.trino.testing.TestingSession.testSessionBuilder;-import static org.assertj.core.api.Assertions.assertThat;-import static org.testng.Assert.assertEquals;--import com.datastrato.gravitino.client.GravitinoAdminClient;-import com.datastrato.gravitino.trino.connector.catalog.CatalogConnectorManager;-import io.trino.Session;-import io.trino.plugin.memory.MemoryPlugin;-import io.trino.testing.AbstractTestQueryFramework;-import io.trino.testing.DistributedQueryRunner;-import io.trino.testing.MaterializedResult;-import io.trino.testing.MaterializedRow;-import io.trino.testing.QueryRunner;-import java.util.HashMap;-import java.util.List;-import java.util.concurrent.TimeUnit;-import org.testcontainers.shaded.org.awaitility.Awaitility;-import org.testng.annotations.Test;--public class TestGravitinoConnectorWithSimpleCatalogName extends AbstractTestQueryFramework {-- GravitinoMockServer server;-- @Override- protected QueryRunner createQueryRunner() throws Exception {- server = closeAfterClass(new GravitinoMockServer(true));- GravitinoAdminClient gravitinoClient = server.createGravitinoClient();-- Session session = testSessionBuilder().setCatalog("gravitino").build();- QueryRunner queryRunner = null;- try {- queryRunner = DistributedQueryRunner.builder(session).setNodeCount(1).build();-- TestGravitinoPlugin gravitinoPlugin = new TestGravitinoPlugin(gravitinoClient);- queryRunner.installPlugin(gravitinoPlugin);- queryRunner.installPlugin(new MemoryPlugin());-- // create a gravitino connector named gravitino using metalake test- HashMap<String, String> properties = new HashMap<>();- properties.put("gravitino.metalake", "test");- properties.put("gravitino.uri", "http://127.0.0.1:8090");- properties.put("gravitino.simplify-catalog-names", "true");- queryRunner.createCatalog("gravitino", "gravitino", properties);-- CatalogConnectorManager catalogConnectorManager =- gravitinoPlugin.getCatalogConnectorManager();- server.setCatalogConnectorManager(catalogConnectorManager);- // Wait for the catalog to be created. Wait for at least 30 seconds.- Awaitility.await()- .atMost(30, TimeUnit.SECONDS)- .pollInterval(1, TimeUnit.SECONDS)- .until(() -> !catalogConnectorManager.getCatalogs().isEmpty());- } catch (Exception e) {- throw new RuntimeException("Create query runner failed", e);- }- return queryRunner;- }-- @Test- public void testCatalogName() {- assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("gravitino");- assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("memory");- assertUpdate("call gravitino.system.create_catalog('memory1', 'memory', Map())");- assertThat(computeActual("show catalogs").getOnlyColumnAsSet()).contains("memory1");-- String schemaName = "db1";- String fullSchemaName = String.format("\"%s\".%s", "memory", schemaName);- assertUpdate("create schema " + fullSchemaName);- assertThat(computeActual("show schemas from \"memory\"").getOnlyColumnAsSet())- .contains(schemaName);-- assertUpdate("drop schema " + fullSchemaName);- assertUpdate("call gravitino.system.drop_catalog('memory1')");- }-- @Test- public void testSystemTable() throws Exception {- MaterializedResult expectedResult = computeActual("select * from gravitino.system.catalog");- assertEquals(expectedResult.getRowCount(), 1);- List<MaterializedRow> expectedRows = expectedResult.getMaterializedRows();- MaterializedRow row = expectedRows.get(0);- assertEquals(row.getField(0), "memory");- assertEquals(row.getField(1), "memory");- assertEquals(row.getField(2), "{\"max_ttl\":\"10\"}");- }-}