World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#3698] refactor (API): Refactor client side RelationalCatalog to use relative path in NameIdentifier (#3789)
Shaofeng Shic2ae2a35823b
diff --git a/catalogs/catalog-hive/src/test/java/com/datastrato/gravitino/catalog/hive/integration/test/CatalogHiveIT.java b/catalogs/catalog-hive/src/test/java/com/datastrato/gravitino/catalog/hive/integration/test/CatalogHiveIT.javaindex d45c5c7c36..57d54808a7 100644--- a/catalogs/catalog-hive/src/test/java/com/datastrato/gravitino/catalog/hive/integration/test/CatalogHiveIT.java+++ b/catalogs/catalog-hive/src/test/java/com/datastrato/gravitino/catalog/hive/integration/test/CatalogHiveIT.java@@ -264,7 +264,6 @@ public class CatalogHiveIT extends AbstractIT {}private static void createSchema() throws TException, InterruptedException {- NameIdentifier ident = NameIdentifier.of(metalakeName, catalogName, schemaName);Map<String, String> properties = Maps.newHashMap();properties.put("key1", "val1");properties.put("key2", "val2");@@ -277,8 +276,8 @@ public class CatalogHiveIT extends AbstractIT {schemaName.toLowerCase()));String comment = "comment";- catalog.asSchemas().createSchema(ident.name(), comment, properties);- Schema loadSchema = catalog.asSchemas().loadSchema(ident.name());+ catalog.asSchemas().createSchema(schemaName, comment, properties);+ Schema loadSchema = catalog.asSchemas().loadSchema(schemaName);Assertions.assertEquals(schemaName.toLowerCase(), loadSchema.name());Assertions.assertEquals(comment, loadSchema.comment());Assertions.assertEquals("val1", loadSchema.properties().get("key1"));@@ -348,8 +347,7 @@ public class CatalogHiveIT extends AbstractIT {// Create table from Gravitino APIColumn[] columns = createColumns();- NameIdentifier nameIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier nameIdentifier = NameIdentifier.of(schemaName, tableName);Distribution distribution =Distributions.of(Strategy.EVEN, 10, NamedReference.field(HIVE_COL_NAME1));@@ -448,8 +446,7 @@ public class CatalogHiveIT extends AbstractIT {// Create table from Gravitino APIColumn[] columns = createColumns();- NameIdentifier nameIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier nameIdentifier = NameIdentifier.of(schemaName, tableName);Map<String, String> properties = createProperties();Table createdTable =catalog@@ -546,8 +543,7 @@ public class CatalogHiveIT extends AbstractIT {@Testpublic void testHiveTableProperties() throws TException, InterruptedException {Column[] columns = createColumns();- NameIdentifier nameIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier nameIdentifier = NameIdentifier.of(schemaName, tableName);// test default propertiesTable createdTable =catalog@@ -570,7 +566,7 @@ public class CatalogHiveIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, table2),+ NameIdentifier.of(schemaName, table2),columns,TABLE_COMMENT,ImmutableMap.of(@@ -607,7 +603,7 @@ public class CatalogHiveIT extends AbstractIT {// test alter properties exceptionTableCatalog tableCatalog = catalog.asTableCatalog();- NameIdentifier id = NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier id = NameIdentifier.of(schemaName, tableName);TableChange change = TableChange.setProperty(TRANSIENT_LAST_DDL_TIME, "1234");IllegalArgumentException exception =assertThrows(@@ -621,8 +617,7 @@ public class CatalogHiveIT extends AbstractIT {@Testpublic void testHiveSchemaProperties() throws TException, InterruptedException {// test LOCATION property- NameIdentifier schemaIdent =- NameIdentifier.of(metalakeName, catalogName, GravitinoITUtils.genRandomName(SCHEMA_PREFIX));+ String schemaName = GravitinoITUtils.genRandomName(SCHEMA_PREFIX);Map<String, String> properties = Maps.newHashMap();String expectedSchemaLocation =String.format(@@ -631,18 +626,14 @@ public class CatalogHiveIT extends AbstractIT {HiveContainer.HDFS_DEFAULTFS_PORT);properties.put(HiveSchemaPropertiesMetadata.LOCATION, expectedSchemaLocation);- catalog.asSchemas().createSchema(schemaIdent.name(), "comment", properties);+ catalog.asSchemas().createSchema(schemaName, "comment", properties);- Database actualSchema = hiveClientPool.run(client -> client.getDatabase(schemaIdent.name()));+ Database actualSchema = hiveClientPool.run(client -> client.getDatabase(schemaName));String actualSchemaLocation = actualSchema.getLocationUri();Assertions.assertTrue(actualSchemaLocation.endsWith(expectedSchemaLocation));NameIdentifier tableIdent =- NameIdentifier.of(- metalakeName,- catalogName,- schemaIdent.name(),- GravitinoITUtils.genRandomName(TABLE_PREFIX));+ NameIdentifier.of(schemaName, GravitinoITUtils.genRandomName(TABLE_PREFIX));catalog.asTableCatalog().createTable(@@ -652,7 +643,7 @@ public class CatalogHiveIT extends AbstractIT {ImmutableMap.of(),Transforms.EMPTY_TRANSFORM);org.apache.hadoop.hive.metastore.api.Table actualTable =- hiveClientPool.run(client -> client.getTable(schemaIdent.name(), tableIdent.name()));+ hiveClientPool.run(client -> client.getTable(schemaName, tableIdent.name()));String actualTableLocation = actualTable.getSd().getLocation();// use `tableIdent.name().toLowerCase()` because HMS will convert table name to lowerString expectedTableLocation = expectedSchemaLocation + "/" + tableIdent.name().toLowerCase();@@ -665,8 +656,7 @@ public class CatalogHiveIT extends AbstractIT {// Create table from Gravitino APIColumn[] columns = createColumns();- NameIdentifier nameIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier nameIdentifier = NameIdentifier.of(schemaName, tableName);Map<String, String> properties = createProperties();Table createdTable =catalog@@ -713,8 +703,7 @@ public class CatalogHiveIT extends AbstractIT {public void testListPartitionNames() throws TException, InterruptedException {// test empty partitionsColumn[] columns = createColumns();- NameIdentifier nameIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier nameIdentifier = NameIdentifier.of(schemaName, tableName);Table nonPartitionedTable =catalog.asTableCatalog()@@ -740,8 +729,7 @@ public class CatalogHiveIT extends AbstractIT {public void testListPartitions() throws TException, InterruptedException {// test empty partitionsColumn[] columns = createColumns();- NameIdentifier nameIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier nameIdentifier = NameIdentifier.of(schemaName, tableName);Table nonPartitionedTable =catalog.asTableCatalog()@@ -981,8 +969,7 @@ public class CatalogHiveIT extends AbstractIT {Column[] columns = createColumns();NameIdentifier nameIdentifier =- NameIdentifier.of(- metalakeName, catalogName, schemaName, GravitinoITUtils.genRandomName(TABLE_PREFIX));+ NameIdentifier.of(schemaName, GravitinoITUtils.genRandomName(TABLE_PREFIX));Map<String, String> properties = createProperties();Table table =catalog@@ -1058,7 +1045,7 @@ public class CatalogHiveIT extends AbstractIT {@Testvoid testAlterUnknownTable() {- NameIdentifier identifier = NameIdentifier.of(metalakeName, catalogName, schemaName, "unknown");+ NameIdentifier identifier = NameIdentifier.of(schemaName, "unknown");TableCatalog tableCatalog = catalog.asTableCatalog();TableChange change = TableChange.updateComment("new_comment");Assertions.assertThrows(@@ -1075,7 +1062,7 @@ public class CatalogHiveIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),columns,TABLE_COMMENT,createProperties(),@@ -1086,7 +1073,7 @@ public class CatalogHiveIT extends AbstractIT {catalog.asTableCatalog().alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.rename(ALTER_TABLE_NAME),TableChange.updateComment(TABLE_COMMENT + "_new"),TableChange.removeProperty("key1"),@@ -1128,7 +1115,7 @@ public class CatalogHiveIT extends AbstractIT {// test alter partition column exceptionTableCatalog tableCatalog = catalog.asTableCatalog();- NameIdentifier id = NameIdentifier.of(metalakeName, catalogName, schemaName, ALTER_TABLE_NAME);+ NameIdentifier id = NameIdentifier.of(schemaName, ALTER_TABLE_NAME);TableChange updateType =TableChange.updateColumnType(new String[] {HIVE_COL_NAME3}, Types.IntegerType.get());RuntimeException exception =@@ -1189,11 +1176,7 @@ public class CatalogHiveIT extends AbstractIT {Column[] newColumns = new Column[] {col1, col2, col3};NameIdentifier tableIdentifier =- NameIdentifier.of(- metalakeName,- catalogName,- schemaName,- GravitinoITUtils.genRandomName("CatalogHiveIT_table"));+ NameIdentifier.of(schemaName, GravitinoITUtils.genRandomName("CatalogHiveIT_table"));catalog.asTableCatalog().createTable(@@ -1248,14 +1231,12 @@ public class CatalogHiveIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),createColumns(),TABLE_COMMENT,createProperties(),Transforms.EMPTY_TRANSFORM);- catalog- .asTableCatalog()- .dropTable(NameIdentifier.of(metalakeName, catalogName, schemaName, ALTER_TABLE_NAME));+ catalog.asTableCatalog().dropTable(NameIdentifier.of(schemaName, ALTER_TABLE_NAME));// Directly get table from hive metastore to check if the table is dropped successfully.assertThrows(@@ -1265,25 +1246,23 @@ public class CatalogHiveIT extends AbstractIT {@Testpublic void testAlterSchema() throws TException, InterruptedException {- NameIdentifier ident = NameIdentifier.of(metalakeName, catalogName, schemaName);-GravitinoMetalake metalake = client.loadMetalake(metalakeName);Catalog catalog = metalake.loadCatalog(catalogName);- Schema schema = catalog.asSchemas().loadSchema(ident.name());+ Schema schema = catalog.asSchemas().loadSchema(schemaName);Assertions.assertNull(schema.auditInfo().lastModifier());Assertions.assertEquals(AuthConstants.ANONYMOUS_USER, schema.auditInfo().creator());schema =catalog.asSchemas().alterSchema(- ident.name(),+ schemaName,SchemaChange.removeProperty("key1"),SchemaChange.setProperty("key2", "val2-alter"));Assertions.assertEquals(AuthConstants.ANONYMOUS_USER, schema.auditInfo().lastModifier());Assertions.assertEquals(AuthConstants.ANONYMOUS_USER, schema.auditInfo().creator());- Map<String, String> properties2 = catalog.asSchemas().loadSchema(ident.name()).properties();+ Map<String, String> properties2 = catalog.asSchemas().loadSchema(schemaName).properties();Assertions.assertFalse(properties2.containsKey("key1"));Assertions.assertEquals("val2-alter", properties2.get("key2"));@@ -1324,12 +1303,11 @@ public class CatalogHiveIT extends AbstractIT {for (int i = 1; i < schemaName.length(); i++) {// We can't get the schema by prefixfinal int length = i;- final NameIdentifier id =- NameIdentifier.of(metalakeName, catalogName, schemaName.substring(0, length));+ final NameIdentifier id = NameIdentifier.of(schemaName.substring(0, length));Assertions.assertThrows(NoSuchSchemaException.class, () -> schemas.loadSchema(id.name()));}- NameIdentifier idC = NameIdentifier.of(metalakeName, catalogName, schemaName + "a");+ NameIdentifier idC = NameIdentifier.of(schemaName + "a");Assertions.assertThrows(NoSuchSchemaException.class, () -> schemas.loadSchema(idC.name()));TableCatalog tableCatalog = catalog.asTableCatalog();@@ -1337,12 +1315,11 @@ public class CatalogHiveIT extends AbstractIT {for (int i = 1; i < tableName.length(); i++) {// We can't get the table by prefixfinal int length = i;- final NameIdentifier id =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName.substring(0, length));+ final NameIdentifier id = NameIdentifier.of(schemaName, tableName.substring(0, length));Assertions.assertThrows(NoSuchTableException.class, () -> tableCatalog.loadTable(id));}- NameIdentifier idD = NameIdentifier.of(metalakeName, catalogName, schemaName, tableName + "a");+ NameIdentifier idD = NameIdentifier.of(schemaName, tableName + "a");Assertions.assertThrows(NoSuchTableException.class, () -> tableCatalog.loadTable(idD));}@@ -1408,14 +1385,14 @@ public class CatalogHiveIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),columns,TABLE_COMMENT,createProperties(),Transforms.EMPTY_TRANSFORM);- NameIdentifier id3 = NameIdentifier.of(metalakeName, catalogName, schemaName, newTableName);- NameIdentifier id4 = NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier id3 = NameIdentifier.of(schemaName, newTableName);+ NameIdentifier id4 = NameIdentifier.of(schemaName, tableName);TableChange newRename = TableChange.rename(newTableName);TableChange oldRename = TableChange.rename(tableName);TableCatalog tableCatalog = catalog.asTableCatalog();@@ -1467,7 +1444,7 @@ public class CatalogHiveIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),columns,TABLE_COMMENT,createProperties(),@@ -1478,9 +1455,7 @@ public class CatalogHiveIT extends AbstractIT {checkTableReadWrite(hiveTab);Assertions.assertEquals(MANAGED_TABLE.name(), hiveTab.getTableType());Path tableDirectory = new Path(hiveTab.getSd().getLocation());- catalog- .asTableCatalog()- .dropTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ catalog.asTableCatalog().dropTable(NameIdentifier.of(schemaName, tableName));Boolean existed = hiveClientPool.run(client -> client.tableExists(schemaName, tableName));Assertions.assertFalse(existed, "The hive table should not exist");Assertions.assertFalse(hdfs.exists(tableDirectory), "The table directory should not exist");@@ -1492,7 +1467,7 @@ public class CatalogHiveIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),columns,TABLE_COMMENT,ImmutableMap.of(TABLE_TYPE, EXTERNAL_TABLE.name().toLowerCase(Locale.ROOT)),@@ -1502,9 +1477,7 @@ public class CatalogHiveIT extends AbstractIT {hiveClientPool.run(client -> client.getTable(schemaName, tableName));checkTableReadWrite(hiveTab);Assertions.assertEquals(EXTERNAL_TABLE.name(), hiveTab.getTableType());- catalog- .asTableCatalog()- .dropTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ catalog.asTableCatalog().dropTable(NameIdentifier.of(schemaName, tableName));Boolean existed = hiveClientPool.run(client -> client.tableExists(schemaName, tableName));Assertions.assertFalse(existed, "The table should be not exist");@@ -1519,7 +1492,7 @@ public class CatalogHiveIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),columns,TABLE_COMMENT,createProperties(),@@ -1529,9 +1502,7 @@ public class CatalogHiveIT extends AbstractIT {hiveClientPool.run(client -> client.getTable(schemaName, tableName));checkTableReadWrite(hiveTab);Assertions.assertEquals(MANAGED_TABLE.name(), hiveTab.getTableType());- catalog- .asTableCatalog()- .purgeTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ catalog.asTableCatalog().purgeTable(NameIdentifier.of(schemaName, tableName));Boolean existed = hiveClientPool.run(client -> client.tableExists(schemaName, tableName));Assertions.assertFalse(existed, "The hive table should not exist");Path tableDirectory = new Path(hiveTab.getSd().getLocation());@@ -1546,7 +1517,7 @@ public class CatalogHiveIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),columns,TABLE_COMMENT,ImmutableMap.of(TABLE_TYPE, EXTERNAL_TABLE.name().toLowerCase(Locale.ROOT)),@@ -1557,7 +1528,7 @@ public class CatalogHiveIT extends AbstractIT {checkTableReadWrite(hiveTab);Assertions.assertEquals(EXTERNAL_TABLE.name(), hiveTab.getTableType());TableCatalog tableCatalog = catalog.asTableCatalog();- NameIdentifier id = NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier id = NameIdentifier.of(schemaName, tableName);Assertions.assertThrows(UnsupportedOperationException.class,() -> {@@ -1578,7 +1549,7 @@ public class CatalogHiveIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),columns,TABLE_COMMENT,ImmutableMap.of(TABLE_TYPE, EXTERNAL_TABLE.name().toLowerCase(Locale.ROOT)),@@ -1593,15 +1564,11 @@ public class CatalogHiveIT extends AbstractIT {// Drop table from catalog, drop non-exist table should return false;Assertions.assertFalse(- catalog- .asTableCatalog()- .dropTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName)),+ catalog.asTableCatalog().dropTable(NameIdentifier.of(schemaName, tableName)),"The table should not be found in the catalog");Assertions.assertFalse(- catalog- .asTableCatalog()- .tableExists(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName)),+ catalog.asTableCatalog().tableExists(NameIdentifier.of(schemaName, tableName)),"The table should not be found in the catalog");}@@ -1611,7 +1578,7 @@ public class CatalogHiveIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),columns,TABLE_COMMENT,ImmutableMap.of(TABLE_TYPE, EXTERNAL_TABLE.name().toLowerCase(Locale.ROOT)),@@ -1626,15 +1593,11 @@ public class CatalogHiveIT extends AbstractIT {// Drop table from catalog, drop non-exist table should return false;Assertions.assertFalse(- catalog- .asTableCatalog()- .purgeTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName)),+ catalog.asTableCatalog().purgeTable(NameIdentifier.of(schemaName, tableName)),"The table should not be found in the catalog");Assertions.assertFalse(- catalog- .asTableCatalog()- .tableExists(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName)),+ catalog.asTableCatalog().tableExists(NameIdentifier.of(schemaName, tableName)),"The table should not be found in the catalog");}diff --git a/catalogs/catalog-hive/src/test/java/com/datastrato/gravitino/catalog/hive/integration/test/HiveUserAuthenticationIT.java b/catalogs/catalog-hive/src/test/java/com/datastrato/gravitino/catalog/hive/integration/test/HiveUserAuthenticationIT.javaindex 5d2ee86a5a..1ac73a6f18 100644--- a/catalogs/catalog-hive/src/test/java/com/datastrato/gravitino/catalog/hive/integration/test/HiveUserAuthenticationIT.java+++ b/catalogs/catalog-hive/src/test/java/com/datastrato/gravitino/catalog/hive/integration/test/HiveUserAuthenticationIT.java@@ -231,8 +231,7 @@ public class HiveUserAuthenticationIT extends AbstractIT {() -> catalog.asSchemas().createSchema(SCHEMA_NAME, "comment", ImmutableMap.of()));// Create table- NameIdentifier tableNameIdentifier =- NameIdentifier.of(METALAKE_NAME, CATALOG_NAME, SCHEMA_NAME, TABLE_NAME);+ NameIdentifier tableNameIdentifier = NameIdentifier.of(SCHEMA_NAME, TABLE_NAME);catalog.asTableCatalog().createTable(@@ -246,8 +245,7 @@ public class HiveUserAuthenticationIT extends AbstractIT {// Now try to alter the tablecatalog.asTableCatalog().alterTable(tableNameIdentifier, TableChange.rename("new_table"));- NameIdentifier newTableIdentifier =- NameIdentifier.of(METALAKE_NAME, CATALOG_NAME, SCHEMA_NAME, "new_table");+ NameIdentifier newTableIdentifier = NameIdentifier.of(SCHEMA_NAME, "new_table");// Old table name should not existAssertions.assertFalse(catalog.asTableCatalog().tableExists(tableNameIdentifier));diff --git a/catalogs/catalog-hive/src/test/java/com/datastrato/gravitino/catalog/hive/integration/test/ProxyCatalogHiveIT.java b/catalogs/catalog-hive/src/test/java/com/datastrato/gravitino/catalog/hive/integration/test/ProxyCatalogHiveIT.javaindex 8e1f879b08..837a038b07 100644--- a/catalogs/catalog-hive/src/test/java/com/datastrato/gravitino/catalog/hive/integration/test/ProxyCatalogHiveIT.java+++ b/catalogs/catalog-hive/src/test/java/com/datastrato/gravitino/catalog/hive/integration/test/ProxyCatalogHiveIT.java@@ -128,10 +128,8 @@ public class ProxyCatalogHiveIT extends AbstractIT {String schemaName = GravitinoITUtils.genRandomName(SCHEMA_PREFIX);String anotherSchemaName = GravitinoITUtils.genRandomName(SCHEMA_PREFIX);- NameIdentifier ident = NameIdentifier.of(METALAKE_NAME, CATALOG_NAME, schemaName);-String comment = "comment";- createSchema(schemaName, ident, comment);+ createSchema(schemaName, comment);Database db = hiveClientPool.run(client -> client.getDatabase(schemaName));Assertions.assertEquals(EXPECT_USER, db.getOwnerName());@@ -163,14 +161,11 @@ public class ProxyCatalogHiveIT extends AbstractIT {String tableName = GravitinoITUtils.genRandomName(TABLE_PREFIX);String anotherTableName = GravitinoITUtils.genRandomName(TABLE_PREFIX);- NameIdentifier ident = NameIdentifier.of(METALAKE_NAME, CATALOG_NAME, schemaName);- NameIdentifier nameIdentifier =- NameIdentifier.of(METALAKE_NAME, CATALOG_NAME, schemaName, tableName);- NameIdentifier anotherNameIdentifier =- NameIdentifier.of(METALAKE_NAME, CATALOG_NAME, schemaName, anotherTableName);+ NameIdentifier nameIdentifier = NameIdentifier.of(schemaName, tableName);+ NameIdentifier anotherNameIdentifier = NameIdentifier.of(schemaName, anotherTableName);String comment = "comment";- createSchema(schemaName, ident, comment);+ createSchema(schemaName, comment);Table createdTable =catalog@@ -200,7 +195,7 @@ public class ProxyCatalogHiveIT extends AbstractIT {Assertions.assertTrue(e.getMessage().contains("AccessControlException Permission denied"));}- private static void createSchema(String schemaName, NameIdentifier ident, String comment) {+ private static void createSchema(String schemaName, String comment) {Map<String, String> properties = Maps.newHashMap();properties.put("key1", "val1");properties.put("key2", "val2");@@ -211,7 +206,7 @@ public class ProxyCatalogHiveIT extends AbstractIT {containerSuite.getHiveContainer().getContainerIpAddress(),HiveContainer.HDFS_DEFAULTFS_PORT,schemaName.toLowerCase()));- catalog.asSchemas().createSchema(ident.name(), comment, properties);+ catalog.asSchemas().createSchema(schemaName, comment, properties);}@Test@@ -221,12 +216,10 @@ public class ProxyCatalogHiveIT extends AbstractIT {String schemaName = GravitinoITUtils.genRandomName(SCHEMA_PREFIX);String tableName = GravitinoITUtils.genRandomName(TABLE_PREFIX);- NameIdentifier ident = NameIdentifier.of(METALAKE_NAME, CATALOG_NAME, schemaName);- NameIdentifier nameIdentifier =- NameIdentifier.of(METALAKE_NAME, CATALOG_NAME, schemaName, tableName);+ NameIdentifier nameIdentifier = NameIdentifier.of(schemaName, tableName);String comment = "comment";- createSchema(schemaName, ident, comment);+ createSchema(schemaName, comment);// create a partitioned tableColumn[] columns = createColumns();diff --git a/catalogs/catalog-jdbc-doris/src/test/java/com/datastrato/gravitino/catalog/doris/integration/test/CatalogDorisIT.java b/catalogs/catalog-jdbc-doris/src/test/java/com/datastrato/gravitino/catalog/doris/integration/test/CatalogDorisIT.javaindex 26a87ada3c..42b8b5bff6 100644--- a/catalogs/catalog-jdbc-doris/src/test/java/com/datastrato/gravitino/catalog/doris/integration/test/CatalogDorisIT.java+++ b/catalogs/catalog-jdbc-doris/src/test/java/com/datastrato/gravitino/catalog/doris/integration/test/CatalogDorisIT.java@@ -231,7 +231,7 @@ public class CatalogDorisIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),createColumns(),"Created by gravitino client",createTableProperties(),@@ -322,8 +322,7 @@ public class CatalogDorisIT extends AbstractIT {@Testvoid testDorisTableBasicOperation() {// create a table- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Column[] columns = createColumns();Distribution distribution = createDistribution();@@ -357,8 +356,7 @@ public class CatalogDorisIT extends AbstractIT {// rename tableString newTableName = GravitinoITUtils.genRandomName("new_table_name");tableCatalog.alterTable(tableIdentifier, TableChange.rename(newTableName));- NameIdentifier newTableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, newTableName);+ NameIdentifier newTableIdentifier = NameIdentifier.of(schemaName, newTableName);Table renamedTable = tableCatalog.loadTable(newTableIdentifier);ITUtils.assertionsTableInfo(newTableName, table_comment, Arrays.asList(columns), properties, indexes, renamedTable);@@ -479,8 +477,7 @@ public class CatalogDorisIT extends AbstractIT {@Testvoid testAlterDorisTable() {// create a table- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Column[] columns = createColumns();Distribution distribution = createDistribution();@@ -572,8 +569,7 @@ public class CatalogDorisIT extends AbstractIT {void testDorisIndex() {String tableName = GravitinoITUtils.genRandomName("test_add_index");- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Column[] columns = createColumns();Distribution distribution = createDistribution();@@ -593,7 +589,7 @@ public class CatalogDorisIT extends AbstractIT {// add index test.tableCatalog.alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.addIndex(Index.IndexType.PRIMARY_KEY, "k1_index", new String[][] {{DORIS_COL_NAME1}}));@@ -605,14 +601,13 @@ public class CatalogDorisIT extends AbstractIT {assertEquals(1,tableCatalog- .loadTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName))+ .loadTable(NameIdentifier.of(schemaName, tableName)).index().length));// delete index and add new column and index.tableCatalog.alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.deleteIndex("k1_index", true),TableChange.addIndex(Index.IndexType.PRIMARY_KEY, "k2_index", new String[][] {{DORIS_COL_NAME2}}));@@ -625,8 +620,7 @@ public class CatalogDorisIT extends AbstractIT {assertEquals(1,tableCatalog- .loadTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName))+ .loadTable(NameIdentifier.of(schemaName, tableName)).index().length));}diff --git a/catalogs/catalog-jdbc-mysql/src/test/java/com/datastrato/gravitino/catalog/mysql/integration/test/AuditCatalogMysqlIT.java b/catalogs/catalog-jdbc-mysql/src/test/java/com/datastrato/gravitino/catalog/mysql/integration/test/AuditCatalogMysqlIT.javaindex 9929b2669d..20a45fe867 100644--- a/catalogs/catalog-jdbc-mysql/src/test/java/com/datastrato/gravitino/catalog/mysql/integration/test/AuditCatalogMysqlIT.java+++ b/catalogs/catalog-jdbc-mysql/src/test/java/com/datastrato/gravitino/catalog/mysql/integration/test/AuditCatalogMysqlIT.java@@ -113,7 +113,7 @@ public class AuditCatalogMysqlIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),new Column[] {col1},"comment",properties);@@ -123,14 +123,12 @@ public class AuditCatalogMysqlIT extends AbstractIT {catalog.asTableCatalog().alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.addColumn(new String[] {"col_4"}, Types.StringType.get()));Assertions.assertEquals(expectUser, table.auditInfo().creator());Assertions.assertEquals(expectUser, table.auditInfo().lastModifier());- catalog- .asTableCatalog()- .dropTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ catalog.asTableCatalog().dropTable(NameIdentifier.of(schemaName, tableName));catalog.asSchemas().dropSchema(schemaName, true);metalake.dropCatalog(catalogName);}diff --git a/catalogs/catalog-jdbc-mysql/src/test/java/com/datastrato/gravitino/catalog/mysql/integration/test/CatalogMysqlIT.java b/catalogs/catalog-jdbc-mysql/src/test/java/com/datastrato/gravitino/catalog/mysql/integration/test/CatalogMysqlIT.javaindex 00f2efd374..cc6a97460d 100644--- a/catalogs/catalog-jdbc-mysql/src/test/java/com/datastrato/gravitino/catalog/mysql/integration/test/CatalogMysqlIT.java+++ b/catalogs/catalog-jdbc-mysql/src/test/java/com/datastrato/gravitino/catalog/mysql/integration/test/CatalogMysqlIT.java@@ -140,7 +140,7 @@ public class CatalogMysqlIT extends AbstractIT {private void clearTableAndSchema() {NameIdentifier[] nameIdentifiers =- catalog.asTableCatalog().listTables(Namespace.of(metalakeName, catalogName, schemaName));+ catalog.asTableCatalog().listTables(Namespace.of(schemaName));for (NameIdentifier nameIdentifier : nameIdentifiers) {catalog.asTableCatalog().dropTable(nameIdentifier);}@@ -183,11 +183,10 @@ public class CatalogMysqlIT extends AbstractIT {}private void createSchema() {- NameIdentifier ident = NameIdentifier.of(metalakeName, catalogName, schemaName);Map<String, String> prop = Maps.newHashMap();- Schema createdSchema = catalog.asSchemas().createSchema(ident.name(), schema_comment, prop);- Schema loadSchema = catalog.asSchemas().loadSchema(ident.name());+ Schema createdSchema = catalog.asSchemas().createSchema(schemaName, schema_comment, prop);+ Schema loadSchema = catalog.asSchemas().loadSchema(schemaName);Assertions.assertEquals(createdSchema.name(), loadSchema.name());prop.forEach((key, value) -> Assertions.assertEquals(loadSchema.properties().get(key), value));}@@ -258,7 +257,7 @@ public class CatalogMysqlIT extends AbstractIT {// create schema check.String testSchemaName = GravitinoITUtils.genRandomName("test_schema_1");NameIdentifier schemaIdent = NameIdentifier.of(metalakeName, catalogName, testSchemaName);- schemas.createSchema(schemaIdent.name(), schema_comment, Collections.emptyMap());+ schemas.createSchema(testSchemaName, schema_comment, Collections.emptyMap());nameIdentifiers = schemas.listSchemas();schemaNames = Sets.newHashSet(nameIdentifiers);Assertions.assertTrue(schemaNames.contains(testSchemaName));@@ -272,13 +271,12 @@ public class CatalogMysqlIT extends AbstractIT {Assertions.assertThrows(SchemaAlreadyExistsException.class,() -> {- schemas.createSchema(schemaIdent.name(), schema_comment, emptyMap);+ schemas.createSchema(testSchemaName, schema_comment, emptyMap);});// drop schema check.- schemas.dropSchema(schemaIdent.name(), false);- Assertions.assertThrows(- NoSuchSchemaException.class, () -> schemas.loadSchema(schemaIdent.name()));+ schemas.dropSchema(testSchemaName, false);+ Assertions.assertThrows(NoSuchSchemaException.class, () -> schemas.loadSchema(testSchemaName));Assertions.assertThrows(NoSuchSchemaException.class, () -> mysqlService.loadSchema(schemaIdent));@@ -289,8 +287,7 @@ public class CatalogMysqlIT extends AbstractIT {TableCatalog tableCatalog = catalog.asTableCatalog();// create failed check.- NameIdentifier table =- NameIdentifier.of(metalakeName, catalogName, testSchemaName, "test_table");+ NameIdentifier table = NameIdentifier.of(testSchemaName, "test_table");Assertions.assertThrows(NoSuchSchemaException.class,() ->@@ -317,8 +314,7 @@ public class CatalogMysqlIT extends AbstractIT {// Create table from Gravitino APIColumn[] columns = createColumns();- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Distribution distribution = Distributions.NONE;final SortOrder[] sortOrders = new SortOrder[0];@@ -376,7 +372,7 @@ public class CatalogMysqlIT extends AbstractIT {};String name = GravitinoITUtils.genRandomName("table") + "_keyword";- NameIdentifier tableIdentifier = NameIdentifier.of(metalakeName, catalogName, schemaName, name);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, name);Distribution distribution = Distributions.NONE;final SortOrder[] sortOrders = new SortOrder[0];@@ -443,11 +439,7 @@ public class CatalogMysqlIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(- metalakeName,- catalogName,- schemaName,- GravitinoITUtils.genRandomName("mysql_it_table")),+ NameIdentifier.of(schemaName, GravitinoITUtils.genRandomName("mysql_it_table")),newColumns,null,ImmutableMap.of());@@ -502,9 +494,7 @@ public class CatalogMysqlIT extends AbstractIT {mysqlService.executeQuery(sql);Table loadedTable =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));for (Column column : loadedTable.columns()) {switch (column.name()) {@@ -599,9 +589,7 @@ public class CatalogMysqlIT extends AbstractIT {mysqlService.executeQuery(sql);Table loadedTable =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));for (Column column : loadedTable.columns()) {switch (column.name()) {@@ -662,40 +650,32 @@ public class CatalogMysqlIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),- columns,- table_comment,- createProperties());+ NameIdentifier.of(schemaName, tableName), columns, table_comment, createProperties());Assertions.assertThrows(IllegalArgumentException.class,() -> {catalog.asTableCatalog().alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.rename(alertTableName),TableChange.updateComment(table_comment + "_new"));});catalog.asTableCatalog()- .alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),- TableChange.rename(alertTableName));+ .alterTable(NameIdentifier.of(schemaName, tableName), TableChange.rename(alertTableName));catalog.asTableCatalog().alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, alertTableName),+ NameIdentifier.of(schemaName, alertTableName),TableChange.updateComment(table_comment + "_new"),TableChange.addColumn(new String[] {"col_4"}, Types.StringType.get()),TableChange.renameColumn(new String[] {MYSQL_COL_NAME2}, "col_2_new"),TableChange.updateColumnType(new String[] {MYSQL_COL_NAME1}, Types.IntegerType.get()));- Table table =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, alertTableName));+ Table table = catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, alertTableName));Assertions.assertEquals(alertTableName, table.name());Assertions.assertEquals(MYSQL_COL_NAME1, table.columns()[0].name());@@ -724,11 +704,7 @@ public class CatalogMysqlIT extends AbstractIT {Column[] newColumns = new Column[] {col1, col2, col3};NameIdentifier tableIdentifier =- NameIdentifier.of(- metalakeName,- catalogName,- schemaName,- GravitinoITUtils.genRandomName("CatalogJdbcIT_table"));+ NameIdentifier.of(schemaName, GravitinoITUtils.genRandomName("CatalogJdbcIT_table"));catalog.asTableCatalog().createTable(@@ -789,17 +765,14 @@ public class CatalogMysqlIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),- columns,- null,- ImmutableMap.of());+ NameIdentifier.of(schemaName, tableName), columns, null, ImmutableMap.of());Assertions.assertEquals(AuthConstants.ANONYMOUS_USER, table.auditInfo().creator());Assertions.assertNull(table.auditInfo().lastModifier());catalog.asTableCatalog().alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.updateColumnDefaultValue(new String[] {columns[0].name()}, Literals.of("1.2345", Types.FloatType.get())),TableChange.updateColumnDefaultValue(@@ -811,10 +784,7 @@ public class CatalogMysqlIT extends AbstractIT {TableChange.updateColumnDefaultValue(new String[] {columns[4].name()}, Literals.of("2.34", Types.DecimalType.of(3, 2))));- table =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ table = catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));Assertions.assertEquals(Literals.of("1.2345", Types.FloatType.get()), table.columns()[0].defaultValue());@@ -840,7 +810,7 @@ public class CatalogMysqlIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),createColumns(),"Created by gravitino client",ImmutableMap.<String, String>builder().build());@@ -886,8 +856,7 @@ public class CatalogMysqlIT extends AbstractIT {Indexes.unique("u6_key", new String[][] {{"col_3"}, {"col_4"}, {"col_1"}, {"col_2"}}),};- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Map<String, String> properties = createProperties();TableCatalog tableCatalog = catalog.asTableCatalog();@@ -907,7 +876,7 @@ public class CatalogMysqlIT extends AbstractIT {ITUtils.assertionsTableInfo(tableName, table_comment, Arrays.asList(newColumns), properties, indexes, table);- NameIdentifier id = NameIdentifier.of(metalakeName, catalogName, schemaName, "test_failed");+ NameIdentifier id = NameIdentifier.of(schemaName, "test_failed");Index[] indexes2 =new Index[] {Indexes.createMysqlPrimaryKey(new String[][] {{"col_1", "col_2"}})};SortOrder[] sortOrder = new SortOrder[0];@@ -952,7 +921,7 @@ public class CatalogMysqlIT extends AbstractIT {table =tableCatalog.createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, "test_null_key"),+ NameIdentifier.of(schemaName, "test_null_key"),newColumns,table_comment,properties,@@ -986,8 +955,7 @@ public class CatalogMysqlIT extends AbstractIT {Indexes.unique("u1_key", new String[][] {{"col_2"}, {"col_3"}})};- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Map<String, String> properties = createProperties();TableCatalog tableCatalog = catalog.asTableCatalog();@@ -1133,8 +1101,7 @@ public class CatalogMysqlIT extends AbstractIT {Column col4 = Column.of("status", Types.VarCharType.of(255), "code", false, false, null);Column[] newColumns = new Column[] {col1, col2, col3, col4};TableCatalog tableCatalog = catalog.asTableCatalog();- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, "table");+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, "table");Assertions.assertDoesNotThrow(() ->tableCatalog.createTable(@@ -1177,8 +1144,7 @@ public class CatalogMysqlIT extends AbstractIT {Index[] t1_indexes = {Indexes.unique("u1_key", new String[][] {{t1_name}})};- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, t1_name);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, t1_name);tableCatalog.createTable(tableIdentifier,columns,@@ -1193,7 +1159,7 @@ public class CatalogMysqlIT extends AbstractIT {Column t2_col = Column.of(t2_name, Types.LongType.get(), "id", false, false, null);Index[] t2_indexes = {Indexes.unique("u2_key", new String[][] {{t2_name}})};columns = new Column[] {t2_col};- tableIdentifier = NameIdentifier.of(metalakeName, catalogName, schemaName, t2_name);+ tableIdentifier = NameIdentifier.of(schemaName, t2_name);tableCatalog.createTable(tableIdentifier,columns,@@ -1208,7 +1174,7 @@ public class CatalogMysqlIT extends AbstractIT {Column t3_col = Column.of(t3_name, Types.LongType.get(), "id", false, false, null);Index[] t3_indexes = {Indexes.unique("u3_key", new String[][] {{t3_name}})};columns = new Column[] {t3_col};- tableIdentifier = NameIdentifier.of(metalakeName, catalogName, schemaName, t3_name);+ tableIdentifier = NameIdentifier.of(schemaName, t3_name);tableCatalog.createTable(tableIdentifier,columns,@@ -1223,7 +1189,7 @@ public class CatalogMysqlIT extends AbstractIT {Column t4_col = Column.of(t4_name, Types.LongType.get(), "id", false, false, null);Index[] t4_indexes = {Indexes.unique("u4_key", new String[][] {{t4_name}})};columns = new Column[] {t4_col};- tableIdentifier = NameIdentifier.of(metalakeName, catalogName, schemaName, t4_name);+ tableIdentifier = NameIdentifier.of(schemaName, t4_name);tableCatalog.createTable(tableIdentifier,columns,@@ -1234,26 +1200,22 @@ public class CatalogMysqlIT extends AbstractIT {new SortOrder[0],t4_indexes);- Table t1 =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, t1_name));+ Table t1 = tableCatalog.loadTable(NameIdentifier.of(schemaName, t1_name));Arrays.stream(t1.columns()).anyMatch(c -> Objects.equals(c.name(), "t112"));ITUtils.assertionsTableInfo(t1_name, table_comment, Arrays.asList(t1_col), properties, t1_indexes, t1);- Table t2 =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, t2_name));+ Table t2 = tableCatalog.loadTable(NameIdentifier.of(schemaName, t2_name));Arrays.stream(t2.columns()).anyMatch(c -> Objects.equals(c.name(), "t212"));ITUtils.assertionsTableInfo(t2_name, table_comment, Arrays.asList(t2_col), properties, t2_indexes, t2);- Table t3 =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, t3_name));+ Table t3 = tableCatalog.loadTable(NameIdentifier.of(schemaName, t3_name));Arrays.stream(t3.columns()).anyMatch(c -> Objects.equals(c.name(), "t_12"));ITUtils.assertionsTableInfo(t3_name, table_comment, Arrays.asList(t3_col), properties, t3_indexes, t3);- Table t4 =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, t4_name));+ Table t4 = tableCatalog.loadTable(NameIdentifier.of(schemaName, t4_name));Arrays.stream(t4.columns()).anyMatch(c -> Objects.equals(c.name(), "_1__"));ITUtils.assertionsTableInfo(t4_name, table_comment, Arrays.asList(t4_col), properties, t4_indexes, t4);@@ -1386,8 +1348,7 @@ public class CatalogMysqlIT extends AbstractIT {Indexes.unique("u1_key", new String[][] {{"col_2"}, {"col_3"}})};- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, "tableName");+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, "tableName");Map<String, String> properties = createProperties();TableCatalog tableCatalog = catalog.asTableCatalog();Table createdTable =@@ -1407,8 +1368,7 @@ public class CatalogMysqlIT extends AbstractIT {"tableName", table_comment, Arrays.asList(newColumns), properties, indexes, table);// Test create table with same name but different case- NameIdentifier tableIdentifier2 =- NameIdentifier.of(metalakeName, catalogName, schemaName, "TABLENAME");+ NameIdentifier tableIdentifier2 = NameIdentifier.of(schemaName, "TABLENAME");Table tableAgain =Assertions.assertDoesNotThrow(@@ -1450,16 +1410,13 @@ public class CatalogMysqlIT extends AbstractIT {String testTableName = "//";sql = String.format("CREATE TABLE `%s`.`%s` (id int)", testSchemaName, testTableName);mysqlService.executeQuery(sql);- NameIdentifier tableIdent =- NameIdentifier.of(metalakeName, catalogName, testSchemaName, testTableName);+ NameIdentifier tableIdent = NameIdentifier.of(testSchemaName, testTableName);Table table = catalog.asTableCatalog().loadTable(tableIdent);Assertions.assertEquals(testTableName, table.name());NameIdentifier[] tableIdents =- catalog- .asTableCatalog()- .listTables(Namespace.of(metalakeName, catalogName, testSchemaName));+ catalog.asTableCatalog().listTables(Namespace.of(testSchemaName));Assertions.assertTrue(Arrays.stream(tableIdents).anyMatch(t -> t.name().equals(testTableName)));Assertions.assertTrue(catalog.asTableCatalog().dropTable(tableIdent));@@ -1555,7 +1512,7 @@ public class CatalogMysqlIT extends AbstractIT {for (String schema : schemas) {tableCatalog.createTable(- NameIdentifier.of(metalakeName, catalogName, schema, tableName),+ NameIdentifier.of(schema, tableName),newColumns,table_comment,properties,@@ -1564,8 +1521,7 @@ public class CatalogMysqlIT extends AbstractIT {new SortOrder[0],indexes);tableCatalog.createTable(- NameIdentifier.of(- metalakeName, catalogName, schema, GravitinoITUtils.genRandomName("test2")),+ NameIdentifier.of(schema, GravitinoITUtils.genRandomName("test2")),newColumns,table_comment,properties,@@ -1576,8 +1532,7 @@ public class CatalogMysqlIT extends AbstractIT {}for (String schema : schemas) {- NameIdentifier[] nameIdentifiers =- tableCatalog.listTables(Namespace.of(metalakeName, catalogName, schema));+ NameIdentifier[] nameIdentifiers = tableCatalog.listTables(Namespace.of(schema));Assertions.assertEquals(2, nameIdentifiers.length);Assertions.assertTrue(Arrays.stream(nameIdentifiers)@@ -1598,9 +1553,7 @@ public class CatalogMysqlIT extends AbstractIT {mysqlService.executeQuery(String.format("CREATE TABLE %s.%s (bit_col bit);", schemaName, tableName));Table loadedTable =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));Assertions.assertEquals(Types.ExternalType.of("BIT"), loadedTable.columns()[0].dataType());}@@ -1613,7 +1566,7 @@ public class CatalogMysqlIT extends AbstractIT {Column[] newColumns = new Column[] {col1, col2, col3};TableCatalog tableCatalog = catalog.asTableCatalog();tableCatalog.createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),newColumns,table_comment,createProperties(),@@ -1624,7 +1577,7 @@ public class CatalogMysqlIT extends AbstractIT {// add index test.tableCatalog.alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.addIndex(Index.IndexType.UNIQUE_KEY, "u1_key", new String[][] {{"col_2"}, {"col_3"}}),TableChange.addIndex(@@ -1632,8 +1585,7 @@ public class CatalogMysqlIT extends AbstractIT {Indexes.DEFAULT_MYSQL_PRIMARY_KEY_NAME,new String[][] {{"col_1"}}));- Table table =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ Table table = tableCatalog.loadTable(NameIdentifier.of(schemaName, tableName));Index[] indexes =new Index[] {Indexes.unique("u1_key", new String[][] {{"col_2"}, {"col_3"}}),@@ -1644,7 +1596,7 @@ public class CatalogMysqlIT extends AbstractIT {// delete index and add new column and index.tableCatalog.alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.deleteIndex("u1_key", false),TableChange.addColumn(new String[] {"col_4"},@@ -1657,8 +1609,7 @@ public class CatalogMysqlIT extends AbstractIT {Indexes.createMysqlPrimaryKey(new String[][] {{"col_1"}}),Indexes.unique("u2_key", new String[][] {{"col_4"}})};- table =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ table = tableCatalog.loadTable(NameIdentifier.of(schemaName, tableName));Column col4 = Column.of("col_4", Types.VarCharType.of(255), null, true, false, null);newColumns = new Column[] {col1, col2, col3, col4};ITUtils.assertionsTableInfo(@@ -1666,7 +1617,7 @@ public class CatalogMysqlIT extends AbstractIT {// Add a previously existing indextableCatalog.alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.addIndex(Index.IndexType.UNIQUE_KEY, "u1_key", new String[][] {{"col_2"}, {"col_3"}}),TableChange.addIndex(@@ -1679,8 +1630,7 @@ public class CatalogMysqlIT extends AbstractIT {Indexes.unique("u1_key", new String[][] {{"col_2"}, {"col_3"}}),Indexes.unique("u3_key", new String[][] {{"col_1"}, {"col_4"}})};- table =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ table = tableCatalog.loadTable(NameIdentifier.of(schemaName, tableName));ITUtils.assertionsTableInfo(tableName, table_comment, Arrays.asList(newColumns), createProperties(), indexes, table);}@@ -1695,8 +1645,7 @@ public class CatalogMysqlIT extends AbstractIT {String tableName = "auto_increment_table";Column[] newColumns = new Column[] {col1, col2, col3, col4, col5};- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Map<String, String> properties = createProperties();TableCatalog tableCatalog = catalog.asTableCatalog();tableCatalog.createTable(@@ -1780,8 +1729,7 @@ public class CatalogMysqlIT extends AbstractIT {String tableName = "default_value_table";Column[] newColumns = new Column[] {col1, col2, col3};- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Map<String, String> properties = createProperties();TableCatalog tableCatalog = catalog.asTableCatalog();tableCatalog.createTable(@@ -1837,8 +1785,7 @@ public class CatalogMysqlIT extends AbstractIT {String tableName = "default_integer_types_table";Column[] newColumns = new Column[] {col1, col2, col3, col4, col5, col6, col7, col8};- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Map<String, String> properties = createProperties();TableCatalog tableCatalog = catalog.asTableCatalog();tableCatalog.createTable(diff --git a/catalogs/catalog-jdbc-mysql/src/test/java/com/datastrato/gravitino/catalog/mysql/integration/test/CatalogMysqlVersion5IT.java b/catalogs/catalog-jdbc-mysql/src/test/java/com/datastrato/gravitino/catalog/mysql/integration/test/CatalogMysqlVersion5IT.javaindex fb8ee3ae14..61376f2b15 100644--- a/catalogs/catalog-jdbc-mysql/src/test/java/com/datastrato/gravitino/catalog/mysql/integration/test/CatalogMysqlVersion5IT.java+++ b/catalogs/catalog-jdbc-mysql/src/test/java/com/datastrato/gravitino/catalog/mysql/integration/test/CatalogMysqlVersion5IT.java@@ -65,11 +65,7 @@ public class CatalogMysqlVersion5IT extends CatalogMysqlIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(- metalakeName,- catalogName,- schemaName,- GravitinoITUtils.genRandomName("mysql_it_table")),+ NameIdentifier.of(schemaName, GravitinoITUtils.genRandomName("mysql_it_table")),newColumns,null,ImmutableMap.of());diff --git a/catalogs/catalog-jdbc-postgresql/src/test/java/com/datastrato/gravitino/catalog/postgresql/integration/test/CatalogPostgreSqlIT.java b/catalogs/catalog-jdbc-postgresql/src/test/java/com/datastrato/gravitino/catalog/postgresql/integration/test/CatalogPostgreSqlIT.javaindex d248b261f3..edecbc2a72 100644--- a/catalogs/catalog-jdbc-postgresql/src/test/java/com/datastrato/gravitino/catalog/postgresql/integration/test/CatalogPostgreSqlIT.java+++ b/catalogs/catalog-jdbc-postgresql/src/test/java/com/datastrato/gravitino/catalog/postgresql/integration/test/CatalogPostgreSqlIT.java@@ -127,7 +127,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {private void clearTableAndSchema() {NameIdentifier[] nameIdentifiers =- catalog.asTableCatalog().listTables(Namespace.of(metalakeName, catalogName, schemaName));+ catalog.asTableCatalog().listTables(Namespace.of(schemaName));for (NameIdentifier nameIdentifier : nameIdentifiers) {catalog.asTableCatalog().dropTable(nameIdentifier);}@@ -167,11 +167,10 @@ public class CatalogPostgreSqlIT extends AbstractIT {}private void createSchema() {- NameIdentifier ident = NameIdentifier.of(metalakeName, catalogName, schemaName);Schema createdSchema =- catalog.asSchemas().createSchema(ident.name(), schema_comment, Collections.EMPTY_MAP);- Schema loadSchema = catalog.asSchemas().loadSchema(ident.name());+ catalog.asSchemas().createSchema(schemaName, schema_comment, Collections.EMPTY_MAP);+ Schema loadSchema = catalog.asSchemas().loadSchema(schemaName);Assertions.assertEquals(createdSchema.name(), loadSchema.name());Assertions.assertEquals(createdSchema.comment(), loadSchema.comment());}@@ -231,8 +230,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Column col = Column.of("array", Types.ListType.of(IntegerType.get(), false), "col_4_comment");Column[] columns = new Column[] {col};- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);TableCatalog tableCatalog = catalog.asTableCatalog();Table createdTable =@@ -257,8 +255,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {// Create table from Gravitino APIColumn[] columns = columnsWithSpecialNames();- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Distribution distribution = Distributions.NONE;SortOrder[] sortOrders = new SortOrder[0];@@ -303,7 +300,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {// create schema check.String testSchemaName = GravitinoITUtils.genRandomName("test_schema_1");NameIdentifier schemaIdent = NameIdentifier.of(metalakeName, catalogName, testSchemaName);- schemas.createSchema(schemaIdent.name(), schema_comment, Collections.emptyMap());+ schemas.createSchema(testSchemaName, schema_comment, Collections.emptyMap());nameIdentifiers = schemas.listSchemas();schemaNames = Sets.newHashSet(nameIdentifiers);Assertions.assertTrue(schemaNames.contains(testSchemaName));@@ -317,13 +314,12 @@ public class CatalogPostgreSqlIT extends AbstractIT {Assertions.assertThrows(SchemaAlreadyExistsException.class,() -> {- schemas.createSchema(schemaIdent.name(), schema_comment, emptyMap);+ schemas.createSchema(testSchemaName, schema_comment, emptyMap);});// drop schema check.- schemas.dropSchema(schemaIdent.name(), false);- Assertions.assertThrows(- NoSuchSchemaException.class, () -> schemas.loadSchema(schemaIdent.name()));+ schemas.dropSchema(testSchemaName, false);+ Assertions.assertThrows(NoSuchSchemaException.class, () -> schemas.loadSchema(testSchemaName));Assertions.assertThrows(NoSuchSchemaException.class, () -> postgreSqlService.loadSchema(schemaIdent));@@ -334,8 +330,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {TableCatalog tableCatalog = catalog.asTableCatalog();// create failed check.- NameIdentifier table =- NameIdentifier.of(metalakeName, catalogName, testSchemaName, "test_table");+ NameIdentifier table = NameIdentifier.of(testSchemaName, "test_table");Assertions.assertThrows(NoSuchSchemaException.class,() ->@@ -432,8 +427,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {// Create table from Gravitino APIColumn[] columns = createColumns();- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Distribution distribution = Distributions.NONE;SortOrder[] sortOrders = new SortOrder[0];@@ -483,7 +477,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),columns,table_comment,createProperties());@@ -495,7 +489,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {catalog.asTableCatalog().alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.rename(alertTableName),TableChange.updateComment(table_comment + "_new"));});@@ -505,8 +499,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {catalog.asTableCatalog().alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),- TableChange.rename(alertTableName));+ NameIdentifier.of(schemaName, tableName), TableChange.rename(alertTableName));Assertions.assertEquals(AuthConstants.ANONYMOUS_USER, table.auditInfo().creator());Assertions.assertEquals(AuthConstants.ANONYMOUS_USER, table.auditInfo().lastModifier());@@ -514,17 +507,14 @@ public class CatalogPostgreSqlIT extends AbstractIT {catalog.asTableCatalog().alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, alertTableName),+ NameIdentifier.of(schemaName, alertTableName),TableChange.updateComment(table_comment + "_new"),TableChange.addColumn(new String[] {"col_4"}, Types.StringType.get()),TableChange.renameColumn(new String[] {POSTGRESQL_COL_NAME2}, "col_2_new"),TableChange.updateColumnType(new String[] {POSTGRESQL_COL_NAME1}, Types.IntegerType.get()));- table =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, alertTableName));+ table = catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, alertTableName));Assertions.assertEquals(alertTableName, table.name());Assertions.assertEquals(POSTGRESQL_COL_NAME1, table.columns()[0].name());@@ -557,8 +547,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Column[] newColumns = new Column[] {col1, col2, col3};NameIdentifier tableIdentifier =- NameIdentifier.of(- metalakeName, catalogName, schemaName, GravitinoITUtils.genRandomName("jdbc_it_table"));+ NameIdentifier.of(schemaName, GravitinoITUtils.genRandomName("jdbc_it_table"));catalog.asTableCatalog().createTable(@@ -627,8 +616,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Column col4 = Column.of("status", Types.VarCharType.of(255), "code", false, false, null);Column[] newColumns = new Column[] {col1, col2, col3, col4};TableCatalog tableCatalog = catalog.asTableCatalog();- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, "abc");+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, "abc");Assertions.assertDoesNotThrow(() ->tableCatalog.createTable(@@ -680,8 +668,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Indexes.unique("u6_key", new String[][] {{"col_1"}, {"col_3"}, {"col_2"}, {"col_4"}}),};- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);// Test create many indexes with name success.Map<String, String> properties = createProperties();@@ -703,7 +690,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {tableName, table_comment, Arrays.asList(newColumns), properties, indexes, table);// Test create index complex fields fail.- NameIdentifier id = NameIdentifier.of(metalakeName, catalogName, schemaName, "test_failed");+ NameIdentifier id = NameIdentifier.of(schemaName, "test_failed");SortOrder[] sortOrder = new SortOrder[0];Index[] primaryIndex =new Index[] {Indexes.createMysqlPrimaryKey(new String[][] {{"col_1", "col_2"}})};@@ -750,7 +737,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {// Test create index with empty name success.table =tableCatalog.createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, "test_null_key"),+ NameIdentifier.of(schemaName, "test_null_key"),newColumns,table_comment,properties,@@ -771,7 +758,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {// Test create index with same col success.table =tableCatalog.createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, "many_index"),+ NameIdentifier.of(schemaName, "many_index"),newColumns,table_comment,properties,@@ -830,11 +817,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(- metalakeName,- catalogName,- schemaName,- GravitinoITUtils.genRandomName("pg_it_table")),+ NameIdentifier.of(schemaName, GravitinoITUtils.genRandomName("pg_it_table")),newColumns,null,ImmutableMap.of());@@ -859,7 +842,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),columns,table_comment,createProperties());@@ -868,7 +851,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {catalog.asTableCatalog().alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.updateColumnDefaultValue(new String[] {columns[0].name()}, Literals.of("1.234", Types.FloatType.get())),TableChange.updateColumnDefaultValue(@@ -880,10 +863,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {TableChange.updateColumnDefaultValue(new String[] {columns[4].name()}, FunctionExpression.of("current_timestamp")));- table =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ table = catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));Assertions.assertEquals(Literals.of("1.234", Types.FloatType.get()), table.columns()[0].defaultValue());@@ -927,9 +907,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {System.out.println(sql);postgreSqlService.executeQuery(sql);Table loadedTable =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));for (Column column : loadedTable.columns()) {switch (column.name()) {@@ -1008,8 +986,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Index[] t1_indexes = {Indexes.unique("u1_key", new String[][] {{t1_name}})};- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, t1_name);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, t1_name);tableCatalog.createTable(tableIdentifier,columns,@@ -1024,7 +1001,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Column t2_col = Column.of(t2_name, Types.LongType.get(), "id", false, false, null);Index[] t2_indexes = {Indexes.unique("u2_key", new String[][] {{t2_name}})};columns = new Column[] {t2_col};- tableIdentifier = NameIdentifier.of(metalakeName, catalogName, schemaName, t2_name);+ tableIdentifier = NameIdentifier.of(schemaName, t2_name);tableCatalog.createTable(tableIdentifier,columns,@@ -1039,7 +1016,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Column t3_col = Column.of(t3_name, Types.LongType.get(), "id", false, false, null);Index[] t3_indexes = {Indexes.unique("u3_key", new String[][] {{t3_name}})};columns = new Column[] {t3_col};- tableIdentifier = NameIdentifier.of(metalakeName, catalogName, schemaName, t3_name);+ tableIdentifier = NameIdentifier.of(schemaName, t3_name);tableCatalog.createTable(tableIdentifier,columns,@@ -1054,7 +1031,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Column t4_col = Column.of(t4_name, Types.LongType.get(), "id", false, false, null);Index[] t4_indexes = {Indexes.unique("u4_key", new String[][] {{t4_name}})};columns = new Column[] {t4_col};- tableIdentifier = NameIdentifier.of(metalakeName, catalogName, schemaName, t4_name);+ tableIdentifier = NameIdentifier.of(schemaName, t4_name);tableCatalog.createTable(tableIdentifier,columns,@@ -1065,26 +1042,22 @@ public class CatalogPostgreSqlIT extends AbstractIT {new SortOrder[0],t4_indexes);- Table t1 =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, t1_name));+ Table t1 = tableCatalog.loadTable(NameIdentifier.of(schemaName, t1_name));Arrays.stream(t1.columns()).anyMatch(c -> Objects.equals(c.name(), "t112"));ITUtils.assertionsTableInfo(t1_name, table_comment, Arrays.asList(t1_col), properties, t1_indexes, t1);- Table t2 =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, t2_name));+ Table t2 = tableCatalog.loadTable(NameIdentifier.of(schemaName, t2_name));Arrays.stream(t2.columns()).anyMatch(c -> Objects.equals(c.name(), "t212"));ITUtils.assertionsTableInfo(t2_name, table_comment, Arrays.asList(t2_col), properties, t2_indexes, t2);- Table t3 =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, t3_name));+ Table t3 = tableCatalog.loadTable(NameIdentifier.of(schemaName, t3_name));Arrays.stream(t3.columns()).anyMatch(c -> Objects.equals(c.name(), "t_12"));ITUtils.assertionsTableInfo(t3_name, table_comment, Arrays.asList(t3_col), properties, t3_indexes, t3);- Table t4 =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, t4_name));+ Table t4 = tableCatalog.loadTable(NameIdentifier.of(schemaName, t4_name));Arrays.stream(t4.columns()).anyMatch(c -> Objects.equals(c.name(), "_1__"));ITUtils.assertionsTableInfo(t4_name, table_comment, Arrays.asList(t4_col), properties, t4_indexes, t4);@@ -1238,8 +1211,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Column[] newColumns = new Column[] {col1, col2, col3, col4, col5};Index[] indexes = new Index[0];- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, "tablename");+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, "tablename");Map<String, String> properties = createProperties();TableCatalog tableCatalog = catalog.asTableCatalog();Table createdTable =@@ -1264,8 +1236,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {"tablename", "low case table name", Arrays.asList(newColumns), properties, indexes, table);// Test create table with same name but different case- NameIdentifier tableIdentifier2 =- NameIdentifier.of(metalakeName, catalogName, schemaName, "TABLENAME");+ NameIdentifier tableIdentifier2 = NameIdentifier.of(schemaName, "TABLENAME");Column[] upperTableColumns = new Column[] {col1, col4, col5};Table tableAgain =@@ -1321,7 +1292,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, dbs[i], tables[i]),+ NameIdentifier.of(dbs[i], tables[i]),newColumns,dbs[i] + "." + tables[i],Maps.newHashMap(),@@ -1333,8 +1304,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {// list table in schema1for (int i = 0; i < 5; i++) {- NameIdentifier[] tableNames =- catalog.asTableCatalog().listTables(Namespace.of(metalakeName, catalogName, dbs[i]));+ NameIdentifier[] tableNames = catalog.asTableCatalog().listTables(Namespace.of(dbs[i]));Assertions.assertEquals(1, tableNames.length);Assertions.assertEquals(tables[i], tableNames[0].name());}@@ -1369,7 +1339,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, dbs[i], tables[j]),+ NameIdentifier.of(dbs[i], tables[j]),newColumns,dbs[i] + "." + tables[j],Maps.newHashMap(),@@ -1382,8 +1352,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {// list table in schemafor (int i = 0; i < dbs.length; i++) {- NameIdentifier[] tableNames =- catalog.asTableCatalog().listTables(Namespace.of(metalakeName, catalogName, dbs[i]));+ NameIdentifier[] tableNames = catalog.asTableCatalog().listTables(Namespace.of(dbs[i]));Assertions.assertEquals(3, tableNames.length);String[] realNames =Arrays.stream(tableNames).map(NameIdentifier::name).toArray(String[]::new);@@ -1393,10 +1362,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {for (String n : realNames) {Table t =Assertions.assertDoesNotThrow(- () ->- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, dbs[idx], n)));+ () -> catalog.asTableCatalog().loadTable(NameIdentifier.of(dbs[idx], n)));Assertions.assertEquals(n, t.name());// Test the table1 is the `1a`.`table1` not `_a`.`table1` or `__`.`table1`@@ -1431,7 +1397,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {for (String schema : schemas) {tableCatalog.createTable(- NameIdentifier.of(metalakeName, catalogName, schema, tableName),+ NameIdentifier.of(schema, tableName),newColumns,table_comment,properties,@@ -1440,8 +1406,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {new SortOrder[0],indexes);tableCatalog.createTable(- NameIdentifier.of(- metalakeName, catalogName, schema, GravitinoITUtils.genRandomName("test2")),+ NameIdentifier.of(schema, GravitinoITUtils.genRandomName("test2")),newColumns,table_comment,properties,@@ -1452,8 +1417,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {}for (String schema : schemas) {- NameIdentifier[] nameIdentifiers =- tableCatalog.listTables(Namespace.of(metalakeName, catalogName, schema));+ NameIdentifier[] nameIdentifiers = tableCatalog.listTables(Namespace.of(schema));Assertions.assertEquals(2, nameIdentifiers.length);Assertions.assertTrue(Arrays.stream(nameIdentifiers)@@ -1470,9 +1434,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {postgreSqlService.executeQuery(String.format("CREATE TABLE %s.%s (bit_col bit);", schemaName, tableName));Table loadedTable =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));Assertions.assertEquals(Types.ExternalType.of("bit"), loadedTable.columns()[0].dataType());}@@ -1485,7 +1447,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Column[] newColumns = new Column[] {col1, col2, col3};TableCatalog tableCatalog = catalog.asTableCatalog();tableCatalog.createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),newColumns,table_comment,createProperties(),@@ -1496,13 +1458,12 @@ public class CatalogPostgreSqlIT extends AbstractIT {// add index test.tableCatalog.alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.addIndex(Index.IndexType.UNIQUE_KEY, "u1_key", new String[][] {{"col_2"}, {"col_3"}}),TableChange.addIndex(Index.IndexType.PRIMARY_KEY, "pk1_key", new String[][] {{"col_1"}}));- Table table =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ Table table = tableCatalog.loadTable(NameIdentifier.of(schemaName, tableName));Index[] indexes =new Index[] {Indexes.unique("u1_key", new String[][] {{"col_2"}, {"col_3"}}),@@ -1513,7 +1474,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {// delete index and add new column and index.tableCatalog.alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.deleteIndex("u1_key", true),TableChange.addColumn(new String[] {"col_4"},@@ -1526,8 +1487,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Indexes.primary("pk1_key", new String[][] {{"col_1"}}),Indexes.unique("u2_key", new String[][] {{"col_4"}})};- table =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ table = tableCatalog.loadTable(NameIdentifier.of(schemaName, tableName));Column col4 = Column.of("col_4", Types.VarCharType.of(255), null, true, false, null);newColumns = new Column[] {col1, col2, col3, col4};ITUtils.assertionsTableInfo(@@ -1535,7 +1495,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {// Add a previously existing indextableCatalog.alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.addIndex(Index.IndexType.UNIQUE_KEY, "u1_key", new String[][] {{"col_2"}, {"col_3"}}),TableChange.addIndex(@@ -1548,8 +1508,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Indexes.unique("u1_key", new String[][] {{"col_2"}, {"col_3"}}),Indexes.unique("u3_key", new String[][] {{"col_1"}, {"col_4"}})};- table =- tableCatalog.loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ table = tableCatalog.loadTable(NameIdentifier.of(schemaName, tableName));ITUtils.assertionsTableInfo(tableName, table_comment, Arrays.asList(newColumns), createProperties(), indexes, table);}@@ -1563,8 +1522,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Column[] newColumns = new Column[] {col1, col2, col3, col4};String tableName = "auto_increment_table";- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Map<String, String> properties = createProperties();TableCatalog tableCatalog = catalog.asTableCatalog();tableCatalog.createTable(@@ -1636,8 +1594,7 @@ public class CatalogPostgreSqlIT extends AbstractIT {Assertions.assertEquals(Column.DEFAULT_VALUE_NOT_SET, newColumns[0].defaultValue());- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Map<String, String> properties = createProperties();TableCatalog tableCatalog = catalog.asTableCatalog();tableCatalog.createTable(diff --git a/catalogs/catalog-jdbc-postgresql/src/test/java/com/datastrato/gravitino/catalog/postgresql/integration/test/TestMultipleJDBCLoad.java b/catalogs/catalog-jdbc-postgresql/src/test/java/com/datastrato/gravitino/catalog/postgresql/integration/test/TestMultipleJDBCLoad.javaindex 973ad10c9e..bbb4a288f8 100644--- a/catalogs/catalog-jdbc-postgresql/src/test/java/com/datastrato/gravitino/catalog/postgresql/integration/test/TestMultipleJDBCLoad.java+++ b/catalogs/catalog-jdbc-postgresql/src/test/java/com/datastrato/gravitino/catalog/postgresql/integration/test/TestMultipleJDBCLoad.java@@ -93,7 +93,7 @@ public class TestMultipleJDBCLoad extends AbstractIT {mysqlCatalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, mysqlCatalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),new Column[] {col1},comment,Collections.emptyMap());@@ -101,19 +101,14 @@ public class TestMultipleJDBCLoad extends AbstractIT {postgreSqlCatalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, postgreSqlCatalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),new Column[] {col1},comment,Collections.emptyMap());Assertions.assertTrue(- mysqlCatalog- .asTableCatalog()- .tableExists(NameIdentifier.of(metalakeName, mysqlCatalogName, schemaName, tableName)));+ mysqlCatalog.asTableCatalog().tableExists(NameIdentifier.of(schemaName, tableName)));Assertions.assertTrue(- postgreSqlCatalog- .asTableCatalog()- .tableExists(- NameIdentifier.of(metalakeName, postgreSqlCatalogName, schemaName, tableName)));+ postgreSqlCatalog.asTableCatalog().tableExists(NameIdentifier.of(schemaName, tableName)));}}diff --git a/catalogs/catalog-lakehouse-iceberg/src/test/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/integration/test/CatalogIcebergBaseIT.java b/catalogs/catalog-lakehouse-iceberg/src/test/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/integration/test/CatalogIcebergBaseIT.javaindex 50df91f96d..14826ca917 100644--- a/catalogs/catalog-lakehouse-iceberg/src/test/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/integration/test/CatalogIcebergBaseIT.java+++ b/catalogs/catalog-lakehouse-iceberg/src/test/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/integration/test/CatalogIcebergBaseIT.java@@ -168,7 +168,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {private void clearTableAndSchema() {if (catalog.asSchemas().schemaExists(schemaName)) {NameIdentifier[] nameIdentifiers =- catalog.asTableCatalog().listTables(Namespace.of(metalakeName, catalogName, schemaName));+ catalog.asTableCatalog().listTables(Namespace.of(schemaName));for (NameIdentifier nameIdentifier : nameIdentifiers) {catalog.asTableCatalog().dropTable(nameIdentifier);}@@ -216,7 +216,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {}private void createSchema() {- NameIdentifier ident = NameIdentifier.of(metalakeName, catalogName, schemaName);+ NameIdentifier ident = NameIdentifier.of(schemaName);Map<String, String> prop = Maps.newHashMap();prop.put("key1", "val1");prop.put("key2", "val2");@@ -268,7 +268,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {// create schema check.String testSchemaName = GravitinoITUtils.genRandomName("test_schema_1");- NameIdentifier schemaIdent = NameIdentifier.of(metalakeName, catalogName, testSchemaName);+ NameIdentifier schemaIdent = NameIdentifier.of(testSchemaName);schemas.createSchema(schemaIdent.name(), schema_comment, Collections.emptyMap());schemaNames = new HashSet<>(Arrays.asList(schemas.listSchemas()));@@ -314,8 +314,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {TableCatalog tableCatalog = catalog.asTableCatalog();// create failed check.- NameIdentifier table =- NameIdentifier.of(metalakeName, catalogName, testSchemaName, "test_table");+ NameIdentifier table = NameIdentifier.of(testSchemaName, "test_table");Assertions.assertThrows(NoSuchSchemaException.class,() ->@@ -346,8 +345,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {@Testvoid testCreateTableWithNullComment() {Column[] columns = createColumns();- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);TableCatalog tableCatalog = catalog.asTableCatalog();Table createdTable =@@ -363,8 +361,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {// Create table from Gravitino APIColumn[] columns = createColumns();- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Distribution distribution = Distributions.NONE;final SortOrder[] sortOrders =@@ -466,8 +463,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {String timestampTableName = "timestamp_table";- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, timestampTableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, timestampTableName);Map<String, String> properties = createProperties();TableCatalog tableCatalog = catalog.asTableCatalog();@@ -514,7 +510,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {void testListAndDropIcebergTable() {Column[] columns = createColumns();- NameIdentifier table1 = NameIdentifier.of(metalakeName, catalogName, schemaName, "table_1");+ NameIdentifier table1 = NameIdentifier.of(schemaName, "table_1");Map<String, String> properties = createProperties();TableCatalog tableCatalog = catalog.asTableCatalog();@@ -526,8 +522,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {Transforms.EMPTY_TRANSFORM,Distributions.NONE,new SortOrder[0]);- NameIdentifier[] nameIdentifiers =- tableCatalog.listTables(Namespace.of(metalakeName, catalogName, schemaName));+ NameIdentifier[] nameIdentifiers = tableCatalog.listTables(Namespace.of(schemaName));Assertions.assertEquals(1, nameIdentifiers.length);Assertions.assertEquals("table_1", nameIdentifiers[0].name());@@ -536,7 +531,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {Assertions.assertEquals(1, tableIdentifiers.size());Assertions.assertEquals("table_1", tableIdentifiers.get(0).name());- NameIdentifier table2 = NameIdentifier.of(metalakeName, catalogName, schemaName, "table_2");+ NameIdentifier table2 = NameIdentifier.of(schemaName, "table_2");tableCatalog.createTable(table2,columns,@@ -545,7 +540,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {Transforms.EMPTY_TRANSFORM,Distributions.NONE,new SortOrder[0]);- nameIdentifiers = tableCatalog.listTables(Namespace.of(metalakeName, catalogName, schemaName));+ nameIdentifiers = tableCatalog.listTables(Namespace.of(schemaName));Assertions.assertEquals(2, nameIdentifiers.length);Assertions.assertEquals("table_1", nameIdentifiers[0].name());Assertions.assertEquals("table_2", nameIdentifiers[1].name());@@ -558,13 +553,12 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {Assertions.assertDoesNotThrow(() -> tableCatalog.dropTable(table1));- nameIdentifiers = tableCatalog.listTables(Namespace.of(metalakeName, catalogName, schemaName));+ nameIdentifiers = tableCatalog.listTables(Namespace.of(schemaName));Assertions.assertEquals(1, nameIdentifiers.length);Assertions.assertEquals("table_2", nameIdentifiers[0].name());Assertions.assertDoesNotThrow(() -> tableCatalog.dropTable(table2));- Namespace schemaNamespace = Namespace.of(metalakeName, catalogName, schemaName);- nameIdentifiers = tableCatalog.listTables(schemaNamespace);+ nameIdentifiers = tableCatalog.listTables(Namespace.of(schemaName));Assertions.assertEquals(0, nameIdentifiers.length);tableIdentifiers =@@ -579,7 +573,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),columns,table_comment,createProperties(),@@ -592,7 +586,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {catalog.asTableCatalog().alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),TableChange.rename(alertTableName),TableChange.updateComment(table_comment + "_new"));});@@ -601,15 +595,14 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {catalog.asTableCatalog().alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),- TableChange.rename(alertTableName));+ NameIdentifier.of(schemaName, tableName), TableChange.rename(alertTableName));Assertions.assertEquals(AuthConstants.ANONYMOUS_USER, table.auditInfo().lastModifier());Assertions.assertEquals(AuthConstants.ANONYMOUS_USER, table.auditInfo().creator());catalog.asTableCatalog().alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, alertTableName),+ NameIdentifier.of(schemaName, alertTableName),TableChange.updateComment(table_comment + "_new"),TableChange.removeProperty("key1"),TableChange.setProperty("key2", "val2_new"),@@ -619,10 +612,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {TableChange.updateColumnType(new String[] {ICEBERG_COL_NAME1}, Types.IntegerType.get()));- table =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, alertTableName));+ table = catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, alertTableName));Assertions.assertEquals(alertTableName, table.name());Assertions.assertEquals("val2_new", table.properties().get("key2"));@@ -661,9 +651,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {() ->catalog.asTableCatalog()- .alterTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, alertTableName),- withDefaultValue));+ .alterTable(NameIdentifier.of(schemaName, alertTableName), withDefaultValue));Assertions.assertTrue(exception.getMessage()@@ -676,11 +664,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {Column[] newColumns = new Column[] {col1, col2, col3};NameIdentifier tableIdentifier =- NameIdentifier.of(- metalakeName,- catalogName,- schemaName,- GravitinoITUtils.genRandomName("CatalogHiveIT_table"));+ NameIdentifier.of(schemaName, GravitinoITUtils.genRandomName("CatalogHiveIT_table"));catalog.asTableCatalog().createTable(@@ -759,7 +743,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, testTableName),+ NameIdentifier.of(schemaName, testTableName),columns,table_comment,createProperties(),@@ -808,7 +792,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, testTableName),+ NameIdentifier.of(schemaName, testTableName),columns,table_comment,createProperties(),@@ -894,7 +878,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {@Testpublic void testOperatorSchemeProperties() {- NameIdentifier ident = NameIdentifier.of(metalakeName, catalogName, "testCreateSchemaCheck");+ NameIdentifier ident = NameIdentifier.of("testCreateSchemaCheck");Map<String, String> prop = Maps.newHashMap();prop.put(IcebergSchemaPropertiesMetadata.COMMENT, "val1");prop.put("key2", "val2");@@ -940,8 +924,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {public void testTableDistribution() {Column[] columns = createColumns();- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Distribution distribution = Distributions.NONE;final SortOrder[] sortOrders =@@ -1085,8 +1068,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {// Create table from Gravitino APIColumn[] columns = createColumns();- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Distribution distribution = Distributions.NONE;final SortOrder[] sortOrders =@@ -1173,8 +1155,7 @@ public abstract class CatalogIcebergBaseIT extends AbstractIT {public void testTableSortOrder() {Column[] columns = createColumns();- NameIdentifier tableIdentifier =- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ NameIdentifier tableIdentifier = NameIdentifier.of(schemaName, tableName);Distribution distribution = Distributions.NONE;final SortOrder[] sortOrders =diff --git a/catalogs/catalog-lakehouse-iceberg/src/test/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/integration/test/CatalogIcebergKerberosHiveIT.java b/catalogs/catalog-lakehouse-iceberg/src/test/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/integration/test/CatalogIcebergKerberosHiveIT.javaindex 6afd34e15e..d406498a75 100644--- a/catalogs/catalog-lakehouse-iceberg/src/test/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/integration/test/CatalogIcebergKerberosHiveIT.java+++ b/catalogs/catalog-lakehouse-iceberg/src/test/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/integration/test/CatalogIcebergKerberosHiveIT.java@@ -250,8 +250,7 @@ public class CatalogIcebergKerberosHiveIT extends AbstractIT {() -> catalog.asSchemas().createSchema(SCHEMA_NAME, "comment", ImmutableMap.of()));// Create table- NameIdentifier tableNameIdentifier =- NameIdentifier.of(METALAKE_NAME, CATALOG_NAME, SCHEMA_NAME, TABLE_NAME);+ NameIdentifier tableNameIdentifier = NameIdentifier.of(SCHEMA_NAME, TABLE_NAME);catalog.asTableCatalog().createTable(@@ -265,8 +264,7 @@ public class CatalogIcebergKerberosHiveIT extends AbstractIT {// Now try to alter the tablecatalog.asTableCatalog().alterTable(tableNameIdentifier, TableChange.rename("new_table"));- NameIdentifier newTableIdentifier =- NameIdentifier.of(METALAKE_NAME, CATALOG_NAME, SCHEMA_NAME, "new_table");+ NameIdentifier newTableIdentifier = NameIdentifier.of(SCHEMA_NAME, "new_table");// Old table name should not existAssertions.assertFalse(catalog.asTableCatalog().tableExists(tableNameIdentifier));diff --git a/catalogs/catalog-lakehouse-iceberg/src/test/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/integration/test/TestMultipleJDBCLoad.java b/catalogs/catalog-lakehouse-iceberg/src/test/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/integration/test/TestMultipleJDBCLoad.javaindex 9061a40315..92af377654 100644--- a/catalogs/catalog-lakehouse-iceberg/src/test/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/integration/test/TestMultipleJDBCLoad.java+++ b/catalogs/catalog-lakehouse-iceberg/src/test/java/com/datastrato/gravitino/catalog/lakehouse/iceberg/integration/test/TestMultipleJDBCLoad.java@@ -109,7 +109,7 @@ public class TestMultipleJDBCLoad extends AbstractIT {mysqlCatalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, mysqlCatalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),new Column[] {col1},comment,Collections.emptyMap());@@ -117,19 +117,14 @@ public class TestMultipleJDBCLoad extends AbstractIT {postgreSqlCatalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, postgreSqlCatalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),new Column[] {col1},comment,Collections.emptyMap());Assertions.assertTrue(- mysqlCatalog- .asTableCatalog()- .tableExists(NameIdentifier.of(metalakeName, mysqlCatalogName, schemaName, tableName)));+ mysqlCatalog.asTableCatalog().tableExists(NameIdentifier.of(schemaName, tableName)));Assertions.assertTrue(- postgreSqlCatalog- .asTableCatalog()- .tableExists(- NameIdentifier.of(metalakeName, postgreSqlCatalogName, schemaName, tableName)));+ postgreSqlCatalog.asTableCatalog().tableExists(NameIdentifier.of(schemaName, tableName)));}}diff --git a/clients/client-java/src/main/java/com/datastrato/gravitino/client/BaseSchemaCatalog.java b/clients/client-java/src/main/java/com/datastrato/gravitino/client/BaseSchemaCatalog.javaindex 5771a4bcb9..6f117edc54 100644--- a/clients/client-java/src/main/java/com/datastrato/gravitino/client/BaseSchemaCatalog.java+++ b/clients/client-java/src/main/java/com/datastrato/gravitino/client/BaseSchemaCatalog.java@@ -37,14 +37,12 @@ import java.util.stream.Collectors;abstract class BaseSchemaCatalog extends CatalogDTO implements Catalog, SupportsSchemas {/** The REST client to send the requests. */protected final RESTClient restClient;- /** The namespace of current catalog, which is the metalake name. */- protected final Namespace namespace;- /** The namespace of the schemas, which is the metalake name with catalog name. */- protected final Namespace schemaNamespace;+ /** The namespace of current catalog, which is the metalake name. */+ private final Namespace catalogNamespace;BaseSchemaCatalog(- Namespace namespace,+ Namespace catalogNamespace,String name,Catalog.Type type,String provider,@@ -55,11 +53,10 @@ abstract class BaseSchemaCatalog extends CatalogDTO implements Catalog, Supportssuper(name, type, provider, comment, properties, auditDTO);this.restClient = restClient;Namespace.check(- namespace != null && namespace.length() == 1,+ catalogNamespace != null && catalogNamespace.length() == 1,"Catalog namespace must be non-null and have 1 level, the input namespace is %s",- namespace);- this.namespace = namespace;- this.schemaNamespace = Namespace.of(namespace.level(0), name);+ catalogNamespace);+ this.catalogNamespace = catalogNamespace;}@Override@@ -78,7 +75,7 @@ abstract class BaseSchemaCatalog extends CatalogDTO implements Catalog, SupportsEntityListResponse resp =restClient.get(- formatSchemaRequestPath(schemaNamespace),+ formatSchemaRequestPath(schemaNamespace()),EntityListResponse.class,Collections.emptyMap(),ErrorHandlers.schemaErrorHandler());@@ -107,7 +104,7 @@ abstract class BaseSchemaCatalog extends CatalogDTO implements Catalog, SupportsSchemaResponse resp =restClient.post(- formatSchemaRequestPath(schemaNamespace),+ formatSchemaRequestPath(schemaNamespace()),req,SchemaResponse.class,Collections.emptyMap(),@@ -129,7 +126,7 @@ abstract class BaseSchemaCatalog extends CatalogDTO implements Catalog, SupportsSchemaResponse resp =restClient.get(- formatSchemaRequestPath(schemaNamespace) + "/" + RESTUtils.encodeString(schemaName),+ formatSchemaRequestPath(schemaNamespace()) + "/" + RESTUtils.encodeString(schemaName),SchemaResponse.class,Collections.emptyMap(),ErrorHandlers.schemaErrorHandler());@@ -159,7 +156,7 @@ abstract class BaseSchemaCatalog extends CatalogDTO implements Catalog, SupportsSchemaResponse resp =restClient.put(- formatSchemaRequestPath(schemaNamespace) + "/" + RESTUtils.encodeString(schemaName),+ formatSchemaRequestPath(schemaNamespace()) + "/" + RESTUtils.encodeString(schemaName),updatesRequest,SchemaResponse.class,Collections.emptyMap(),@@ -181,7 +178,7 @@ abstract class BaseSchemaCatalog extends CatalogDTO implements Catalog, Supportspublic boolean dropSchema(String schemaName, boolean cascade) throws NonEmptySchemaException {DropResponse resp =restClient.delete(- formatSchemaRequestPath(schemaNamespace) + "/" + RESTUtils.encodeString(schemaName),+ formatSchemaRequestPath(schemaNamespace()) + "/" + RESTUtils.encodeString(schemaName),Collections.singletonMap("cascade", String.valueOf(cascade)),DropResponse.class,Collections.emptyMap(),@@ -190,6 +187,24 @@ abstract class BaseSchemaCatalog extends CatalogDTO implements Catalog, Supportsreturn resp.dropped();}+ /**+ * Get the namespace of the current catalog, which is "metalake".+ *+ * @return The namespace of the current catalog.+ */+ protected Namespace catalogNamespace() {+ return catalogNamespace;+ }++ /**+ * Get the namespace of the schemas, which is "metalake.catalog".+ *+ * @return The namespace of the schemas in this catalog.+ */+ protected Namespace schemaNamespace() {+ return Namespace.of(catalogNamespace.level(0), this.name());+ }+static String formatSchemaRequestPath(Namespace ns) {return new StringBuilder().append("api/metalakes/")diff --git a/clients/client-java/src/main/java/com/datastrato/gravitino/client/RelationalCatalog.java b/clients/client-java/src/main/java/com/datastrato/gravitino/client/RelationalCatalog.javaindex 95f1091727..0b6e0342a7 100644--- a/clients/client-java/src/main/java/com/datastrato/gravitino/client/RelationalCatalog.java+++ b/clients/client-java/src/main/java/com/datastrato/gravitino/client/RelationalCatalog.java@@ -67,7 +67,8 @@ public class RelationalCatalog extends BaseSchemaCatalog implements TableCatalog/*** List all the tables under the given Schema namespace.*- * @param namespace The namespace to list the tables under it.+ * @param namespace The namespace to list the tables under it. This namespace should have 1 level,+ * which is the schema name;* @return A list of {@link NameIdentifier} of the tables under the given namespace.* @throws NoSuchSchemaException if the schema with specified namespace does not exist.*/@@ -75,43 +76,47 @@ public class RelationalCatalog extends BaseSchemaCatalog implements TableCatalogpublic NameIdentifier[] listTables(Namespace namespace) throws NoSuchSchemaException {checkTableNamespace(namespace);+ Namespace fullNamespace = getTableFullNamespace(namespace);EntityListResponse resp =restClient.get(- formatTableRequestPath(namespace),+ formatTableRequestPath(fullNamespace),EntityListResponse.class,Collections.emptyMap(),ErrorHandlers.tableErrorHandler());resp.validate();- return resp.identifiers();+ return Arrays.stream(resp.identifiers())+ .map(ident -> NameIdentifier.of(ident.namespace().level(2), ident.name()))+ .toArray(NameIdentifier[]::new);}/*** Load the table with specified identifier.*- * @param ident The identifier of the table to load.+ * @param ident The identifier of the table to load, which should be a "schema.table" style.* @return The {@link Table} with specified identifier.* @throws NoSuchTableException if the table with specified identifier does not exist.*/@Overridepublic Table loadTable(NameIdentifier ident) throws NoSuchTableException {- checkTableNameIdentifer(ident);+ checkTableNameIdentifier(ident);+ Namespace fullNamespace = getTableFullNamespace(ident.namespace());TableResponse resp =restClient.get(- formatTableRequestPath(ident.namespace()) + "/" + RESTUtils.encodeString(ident.name()),+ formatTableRequestPath(fullNamespace) + "/" + RESTUtils.encodeString(ident.name()),TableResponse.class,Collections.emptyMap(),ErrorHandlers.tableErrorHandler());resp.validate();- return RelationalTable.from(ident.namespace(), resp.getTable(), restClient);+ return RelationalTable.from(fullNamespace, resp.getTable(), restClient);}/*** Create a new table with specified identifier, columns, comment and properties.*- * @param ident The identifier of the table.+ * @param ident The identifier of the table, which should be a "schema.table" style.* @param columns The columns of the table.* @param comment The comment of the table.* @param properties The properties of the table.@@ -132,7 +137,7 @@ public class RelationalCatalog extends BaseSchemaCatalog implements TableCatalogSortOrder[] sortOrders,Index[] indexes)throws NoSuchSchemaException, TableAlreadyExistsException {- checkTableNameIdentifer(ident);+ checkTableNameIdentifier(ident);TableCreateRequest req =new TableCreateRequest(@@ -146,22 +151,23 @@ public class RelationalCatalog extends BaseSchemaCatalog implements TableCatalogtoDTOs(indexes));req.validate();+ Namespace fullNamespace = getTableFullNamespace(ident.namespace());TableResponse resp =restClient.post(- formatTableRequestPath(ident.namespace()),+ formatTableRequestPath(fullNamespace),req,TableResponse.class,Collections.emptyMap(),ErrorHandlers.tableErrorHandler());resp.validate();- return RelationalTable.from(ident.namespace(), resp.getTable(), restClient);+ return RelationalTable.from(fullNamespace, resp.getTable(), restClient);}/*** Alter the table with specified identifier by applying the changes.*- * @param ident The identifier of the table.+ * @param ident The identifier of the table, which should be a "schema.table" style.* @param changes Table changes to apply to the table.* @return The altered {@link Table}.* @throws NoSuchTableException if the table with specified identifier does not exist.@@ -170,7 +176,7 @@ public class RelationalCatalog extends BaseSchemaCatalog implements TableCatalog@Overridepublic Table alterTable(NameIdentifier ident, TableChange... changes)throws NoSuchTableException, IllegalArgumentException {- checkTableNameIdentifer(ident);+ checkTableNameIdentifier(ident);List<TableUpdateRequest> reqs =Arrays.stream(changes)@@ -179,31 +185,33 @@ public class RelationalCatalog extends BaseSchemaCatalog implements TableCatalogTableUpdatesRequest updatesRequest = new TableUpdatesRequest(reqs);updatesRequest.validate();+ Namespace fullNamespace = getTableFullNamespace(ident.namespace());TableResponse resp =restClient.put(- formatTableRequestPath(ident.namespace()) + "/" + RESTUtils.encodeString(ident.name()),+ formatTableRequestPath(fullNamespace) + "/" + RESTUtils.encodeString(ident.name()),updatesRequest,TableResponse.class,Collections.emptyMap(),ErrorHandlers.tableErrorHandler());resp.validate();- return RelationalTable.from(ident.namespace(), resp.getTable(), restClient);+ return RelationalTable.from(fullNamespace, resp.getTable(), restClient);}/*** Drop the table with specified identifier.*- * @param ident The identifier of the table.+ * @param ident The identifier of the table, which should be a "schema.table" style.* @return true if the table is dropped successfully, false if the table does not exist.*/@Overridepublic boolean dropTable(NameIdentifier ident) {- checkTableNameIdentifer(ident);+ checkTableNameIdentifier(ident);+ Namespace fullNamespace = getTableFullNamespace(ident.namespace());DropResponse resp =restClient.delete(- formatTableRequestPath(ident.namespace()) + "/" + RESTUtils.encodeString(ident.name()),+ formatTableRequestPath(fullNamespace) + "/" + RESTUtils.encodeString(ident.name()),DropResponse.class,Collections.emptyMap(),ErrorHandlers.tableErrorHandler());@@ -214,21 +222,20 @@ public class RelationalCatalog extends BaseSchemaCatalog implements TableCatalog/*** Purge the table with specified identifier.*- * @param ident The identifier of the table.+ * @param ident The identifier of the table, which should be a "schema.table" style.* @return true if the table is purged successfully, false otherwise.*/@Overridepublic boolean purgeTable(NameIdentifier ident) throws UnsupportedOperationException {- checkTableNameIdentifer(ident);+ checkTableNameIdentifier(ident);+ Namespace fullNamespace = getTableFullNamespace(ident.namespace());Map<String, String> params = new HashMap<>();params.put("purge", "true");try {DropResponse resp =restClient.delete(- formatTableRequestPath(ident.namespace())- + "/"- + RESTUtils.encodeString(ident.name()),+ formatTableRequestPath(fullNamespace) + "/" + RESTUtils.encodeString(ident.name()),params,DropResponse.class,Collections.emptyMap(),@@ -254,29 +261,39 @@ public class RelationalCatalog extends BaseSchemaCatalog implements TableCatalog}/**- * Check whether the namespace of a table is valid+ * Check whether the namespace of a table is valid, which should be "schema".** @param namespace The namespace to check*/static void checkTableNamespace(Namespace namespace) {Namespace.check(- namespace != null && namespace.length() == 3,- "Table namespace must be non-null and have 3 level, the input namespace is %s",+ namespace != null && namespace.length() == 1,+ "Table namespace must be non-null and have 1 level, the input namespace is %s",namespace);}/**- * Check whether the NameIdentifier of a table is valid+ * Check whether the NameIdentifier of a table is valid, which should be a "schema.table" style.** @param ident The NameIdentifier to check*/- static void checkTableNameIdentifer(NameIdentifier ident) {- NameIdentifier.check(ident != null, "NameIdentifer must not be null");+ static void checkTableNameIdentifier(NameIdentifier ident) {+ NameIdentifier.check(ident != null, "NameIdentifier must not be null");NameIdentifier.check(- ident.name() != null && !ident.name().isEmpty(), "NameIdentifer name must not be empty");+ ident.name() != null && !ident.name().isEmpty(), "NameIdentifier name must not be empty");checkTableNamespace(ident.namespace());}+ /**+ * Get the full namespace of the table with the given table's short namespace (schema name).+ *+ * @param tableNamespace The table's short namespace (schema name).+ * @return full namespace of the table (metalake.catalog.schema).+ */+ private Namespace getTableFullNamespace(Namespace tableNamespace) {+ return Namespace.of(this.catalogNamespace().level(0), this.name(), tableNamespace.level(0));+ }+/*** Create a new builder for the relational catalog.*diff --git a/clients/client-java/src/main/java/com/datastrato/gravitino/client/RelationalTable.java b/clients/client-java/src/main/java/com/datastrato/gravitino/client/RelationalTable.javaindex 26628374b4..627b0982b7 100644--- a/clients/client-java/src/main/java/com/datastrato/gravitino/client/RelationalTable.java+++ b/clients/client-java/src/main/java/com/datastrato/gravitino/client/RelationalTable.java@@ -40,7 +40,7 @@ public class RelationalTable implements Table, SupportsPartitions {/*** Creates a new RelationalTable.*- * @param namespace The namespace of the table.+ * @param namespace The full namespace of the table, including metalake, catalog and schema.* @param tableDTO The table data transfer object.* @param restClient The REST client.* @return A new RelationalTable.@@ -57,25 +57,16 @@ public class RelationalTable implements Table, SupportsPartitions {/*** Creates a new RelationalTable.*- * @param namespace The namespace of the table.+ * @param namespace The full namespace of the table, including metalake, catalog and schema* @param tableDTO The table data transfer object.* @param restClient The REST client.*/- public RelationalTable(Namespace namespace, TableDTO tableDTO, RESTClient restClient) {+ private RelationalTable(Namespace namespace, TableDTO tableDTO, RESTClient restClient) {this.namespace = namespace;this.restClient = restClient;this.table = fromDTO(tableDTO);}- /**- * Returns the namespace of the table.- *- * @return The namespace of the table.- */- public Namespace namespace() {- return namespace;- }-/*** Returns the name of the table.*diff --git a/clients/client-java/src/test/java/com/datastrato/gravitino/client/TestRelationalCatalog.java b/clients/client-java/src/test/java/com/datastrato/gravitino/client/TestRelationalCatalog.javaindex a00ffd1e04..3f8044c36b 100644--- a/clients/client-java/src/test/java/com/datastrato/gravitino/client/TestRelationalCatalog.java+++ b/clients/client-java/src/test/java/com/datastrato/gravitino/client/TestRelationalCatalog.java@@ -176,17 +176,20 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testCreateSchema() throws JsonProcessingException {- NameIdentifier schemaId = NameIdentifier.of(metalakeName, catalogName, "schema1");- String schemaPath = withSlash(RelationalCatalog.formatSchemaRequestPath(schemaId.namespace()));- SchemaDTO schema = createMockSchema("schema1", "comment", Collections.emptyMap());+ String schemaName = "schema1";+ String schemaPath =+ withSlash(+ RelationalCatalog.formatSchemaRequestPath(Namespace.of(metalakeName, catalogName)));+ SchemaDTO schema = createMockSchema(schemaName, "comment", Collections.emptyMap());- SchemaCreateRequest req = new SchemaCreateRequest("schema1", "comment", Collections.emptyMap());+ SchemaCreateRequest req =+ new SchemaCreateRequest(schemaName, "comment", Collections.emptyMap());SchemaResponse resp = new SchemaResponse(schema);buildMockResource(Method.POST, schemaPath, req, resp, SC_OK);Schema createdSchema =- catalog.asSchemas().createSchema(schemaId.name(), "comment", Collections.emptyMap());- Assertions.assertEquals("schema1", createdSchema.name());+ catalog.asSchemas().createSchema(schemaName, "comment", Collections.emptyMap());+ Assertions.assertEquals(schemaName, createdSchema.name());Assertions.assertEquals("comment", createdSchema.comment());Assertions.assertEquals(Collections.emptyMap(), createdSchema.properties());@@ -200,7 +203,7 @@ public class TestRelationalCatalog extends TestBase {Throwable ex =Assertions.assertThrows(NoSuchCatalogException.class,- () -> schemas.createSchema(schemaId.name(), "comment", emptyMap));+ () -> schemas.createSchema(schemaName, "comment", emptyMap));Assertions.assertTrue(ex.getMessage().contains("catalog not found"));// Test throw SchemaAlreadyExistsException@@ -212,16 +215,16 @@ public class TestRelationalCatalog extends TestBase {Throwable ex1 =Assertions.assertThrows(SchemaAlreadyExistsException.class,- () -> schemas.createSchema(schemaId.name(), "comment", emptyMap));+ () -> schemas.createSchema(schemaName, "comment", emptyMap));Assertions.assertTrue(ex1.getMessage().contains("schema already exists"));}@Testpublic void testLoadSchema() throws JsonProcessingException {- NameIdentifier schemaId = NameIdentifier.of(metalakeName, catalogName, "schema1");+ NameIdentifier schemaId = NameIdentifier.of("schema1");String schemaPath =withSlash(- RelationalCatalog.formatSchemaRequestPath(schemaId.namespace())+ RelationalCatalog.formatSchemaRequestPath(Namespace.of(metalakeName, catalogName))+ "/"+ schemaId.name());SchemaDTO schema = createMockSchema("schema1", "comment", Collections.emptyMap());@@ -306,11 +309,14 @@ public class TestRelationalCatalog extends TestBase {EntityListResponse resp = new EntityListResponse(new NameIdentifier[] {table1, table2});buildMockResource(Method.GET, tablePath, null, resp, SC_OK);- NameIdentifier[] tables = catalog.asTableCatalog().listTables(table1.namespace());+ NameIdentifier[] tables = catalog.asTableCatalog().listTables(Namespace.of("schema1"));Assertions.assertEquals(2, tables.length);- Assertions.assertEquals(table1, tables[0]);- Assertions.assertEquals(table2, tables[1]);++ NameIdentifier expectedResult1 = NameIdentifier.of("schema1", "table1");+ NameIdentifier expectedResult2 = NameIdentifier.of("schema1", "table2");+ Assertions.assertEquals(expectedResult1, tables[0]);+ Assertions.assertEquals(expectedResult2, tables[1]);// Test throw NoSuchSchemaExceptionErrorResponse errorResp =@@ -318,7 +324,7 @@ public class TestRelationalCatalog extends TestBase {buildMockResource(Method.GET, tablePath, null, errorResp, SC_NOT_FOUND);TableCatalog tableCatalog = catalog.asTableCatalog();- Namespace namespace1 = table1.namespace();+ Namespace namespace1 = Namespace.of("schema1");Throwable ex =Assertions.assertThrows(NoSuchSchemaException.class, () -> tableCatalog.listTables(namespace1));@@ -341,8 +347,9 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testCreateTable() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");- String tablePath = withSlash(RelationalCatalog.formatTableRequestPath(tableId.namespace()));+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");+ Namespace fullNamespace = Namespace.of(metalakeName, catalogName, tableId.namespace().level(0));+ String tablePath = withSlash(RelationalCatalog.formatTableRequestPath(fullNamespace));ColumnDTO[] columns =new ColumnDTO[] {@@ -449,8 +456,9 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testCreatePartitionedTable() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");- String tablePath = withSlash(RelationalCatalog.formatTableRequestPath(tableId.namespace()));+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");+ Namespace fullNamespace = Namespace.of(metalakeName, catalogName, tableId.namespace().level(0));+ String tablePath = withSlash(RelationalCatalog.formatTableRequestPath(fullNamespace));ColumnDTO[] columns =new ColumnDTO[] {@@ -616,8 +624,9 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testCreateIndexTable() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "index1");- String tablePath = withSlash(RelationalCatalog.formatTableRequestPath(tableId.namespace()));+ NameIdentifier tableId = NameIdentifier.of("schema1", "index1");+ Namespace fullNamespace = Namespace.of(metalakeName, catalogName, tableId.namespace().level(0));+ String tablePath = withSlash(RelationalCatalog.formatTableRequestPath(fullNamespace));ColumnDTO[] columns =new ColumnDTO[] {@@ -713,10 +722,10 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testLoadTable() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");+ Namespace fullNamespace = Namespace.of(metalakeName, catalogName, tableId.namespace().level(0));String tablePath =- withSlash(- RelationalCatalog.formatTableRequestPath(tableId.namespace()) + "/" + tableId.name());+ withSlash(RelationalCatalog.formatTableRequestPath(fullNamespace) + "/" + tableId.name());ColumnDTO[] columns =new ColumnDTO[] {createMockColumn("col1", Types.ByteType.get(), "comment1"),@@ -755,7 +764,7 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testRenameTable() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");ColumnDTO[] columns =new ColumnDTO[] {createMockColumn("col1", Types.ByteType.get(), "comment1")};@@ -779,7 +788,7 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testUpdateTableComment() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");ColumnDTO[] columns =new ColumnDTO[] {createMockColumn("col1", Types.ByteType.get(), "comment1")};@@ -803,7 +812,7 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testSetTableProperty() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");ColumnDTO[] columns =new ColumnDTO[] {createMockColumn("col1", Types.ByteType.get(), "comment1")};Map<String, String> properties = ImmutableMap.of("k1", "v1");@@ -828,7 +837,7 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testRemoveTableProperty() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");ColumnDTO[] columns =new ColumnDTO[] {createMockColumn("col1", Types.ByteType.get(), "comment1")};@@ -851,7 +860,7 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testAddTableColumn() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");ColumnDTO[] columns =new ColumnDTO[] {createMockColumn("col1", Types.ByteType.get(), "comment1"),@@ -886,7 +895,7 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testRenameTableColumn() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");ColumnDTO[] columns =new ColumnDTO[] {createMockColumn("col1", Types.ByteType.get(), "comment1"),@@ -914,7 +923,7 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testUpdateTableColumnComment() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");ColumnDTO[] columns =new ColumnDTO[] {createMockColumn("col1", Types.ByteType.get(), "comment2")};@@ -938,7 +947,7 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testUpdateTableColumnDataType() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");ColumnDTO[] columns =new ColumnDTO[] {createMockColumn("col1", Types.StringType.get(), "comment1")};@@ -962,7 +971,7 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testUpdateTableColumnNullability() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");ColumnDTO[] columns =new ColumnDTO[] {createMockColumn("col1", Types.StringType.get(), "comment1")};@@ -985,7 +994,7 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testUpdateTableColumnPosition() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");ColumnDTO[] columns =new ColumnDTO[] {createMockColumn("col1", Types.ByteType.get(), "comment1"),@@ -1032,7 +1041,7 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testDeleteTableColumn() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");ColumnDTO[] columns =new ColumnDTO[] {createMockColumn("col2", Types.StringType.get(), "comment2")};@@ -1055,10 +1064,10 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testDropTable() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");+ Namespace fullNamespace = Namespace.of(metalakeName, catalogName, tableId.namespace().level(0));String tablePath =- withSlash(- RelationalCatalog.formatTableRequestPath(tableId.namespace()) + "/" + tableId.name());+ withSlash(RelationalCatalog.formatTableRequestPath(fullNamespace) + "/" + tableId.name());DropResponse resp = new DropResponse(true);buildMockResource(Method.DELETE, tablePath, null, resp, SC_OK);@@ -1081,10 +1090,10 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testPurgeTable() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");+ Namespace fullNamespace = Namespace.of(metalakeName, catalogName, tableId.namespace().level(0));String tablePath =- withSlash(- RelationalCatalog.formatTableRequestPath(tableId.namespace()) + "/" + tableId.name());+ withSlash(RelationalCatalog.formatTableRequestPath(fullNamespace) + "/" + tableId.name());DropResponse resp = new DropResponse(true);buildMockResource(Method.DELETE, tablePath, null, resp, SC_OK);@@ -1104,10 +1113,10 @@ public class TestRelationalCatalog extends TestBase {@Testpublic void testPurgeExternalTable() throws JsonProcessingException {- NameIdentifier tableId = NameIdentifier.of(metalakeName, catalogName, "schema1", "table1");+ NameIdentifier tableId = NameIdentifier.of("schema1", "table1");+ Namespace fullNamespace = Namespace.of(metalakeName, catalogName, tableId.namespace().level(0));String tablePath =- withSlash(- RelationalCatalog.formatTableRequestPath(tableId.namespace()) + "/" + tableId.name());+ withSlash(RelationalCatalog.formatTableRequestPath(fullNamespace) + "/" + tableId.name());DropResponse resp = new DropResponse(true);buildMockResource(Method.DELETE, tablePath, null, resp, SC_OK);@@ -1131,8 +1140,9 @@ public class TestRelationalCatalog extends TestBase {private void testAlterTable(NameIdentifier ident, TableUpdateRequest req, TableDTO updatedTable)throws JsonProcessingException {+ Namespace fullNamespace = Namespace.of(metalakeName, catalogName, ident.namespace().level(0));String tablePath =- withSlash(RelationalCatalog.formatTableRequestPath(ident.namespace()) + "/" + ident.name());+ withSlash(RelationalCatalog.formatTableRequestPath(fullNamespace) + "/" + ident.name());TableUpdatesRequest updatesRequest = new TableUpdatesRequest(ImmutableList.of(req));TableResponse resp = new TableResponse(updatedTable);buildMockResource(Method.PUT, tablePath, updatesRequest, resp, SC_OK);diff --git a/clients/client-java/src/test/java/com/datastrato/gravitino/client/TestRelationalTable.java b/clients/client-java/src/test/java/com/datastrato/gravitino/client/TestRelationalTable.javaindex 55b0ed85b7..f9ebecaf60 100644--- a/clients/client-java/src/test/java/com/datastrato/gravitino/client/TestRelationalTable.java+++ b/clients/client-java/src/test/java/com/datastrato/gravitino/client/TestRelationalTable.java@@ -12,6 +12,7 @@ import static org.apache.http.HttpStatus.SC_NOT_FOUND;import static org.apache.http.HttpStatus.SC_NOT_IMPLEMENTED;import com.datastrato.gravitino.NameIdentifier;+import com.datastrato.gravitino.Namespace;import com.datastrato.gravitino.dto.SchemaDTO;import com.datastrato.gravitino.dto.rel.ColumnDTO;import com.datastrato.gravitino.dto.rel.DistributionDTO;@@ -63,8 +64,9 @@ public class TestRelationalTable extends TestRelationalCatalog {TestRelationalCatalog.setUp();// setup schema- NameIdentifier schemaId = NameIdentifier.of(metalakeName, catalogName, schemaName);- String schemaPath = withSlash(RelationalCatalog.formatSchemaRequestPath(schemaId.namespace()));+ String schemaPath =+ withSlash(+ RelationalCatalog.formatSchemaRequestPath(Namespace.of(metalakeName, catalogName)));SchemaDTO mockedSchema = createMockSchema(schemaName, "comment", Collections.emptyMap());SchemaCreateRequest req =@@ -72,12 +74,14 @@ public class TestRelationalTable extends TestRelationalCatalog {SchemaResponse resp = new SchemaResponse(mockedSchema);buildMockResource(Method.POST, schemaPath, req, resp, SC_OK);- catalog.asSchemas().createSchema(schemaId.name(), "comment", Collections.emptyMap());+ catalog.asSchemas().createSchema(schemaName, "comment", Collections.emptyMap());// setup partitioned table- NameIdentifier tableId =- NameIdentifier.of(metalakeName, catalogName, schemaName, partitionedTableName);- String tablePath = withSlash(RelationalCatalog.formatTableRequestPath(tableId.namespace()));+ NameIdentifier tableId = NameIdentifier.of(schemaName, partitionedTableName);+ String tablePath =+ withSlash(+ RelationalCatalog.formatTableRequestPath(+ Namespace.of(metalakeName, catalogName, schemaName)));ColumnDTO[] columns =new ColumnDTO[] {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 792f4a8032..c81f2531c4 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@@ -216,8 +216,7 @@ public class TrinoConnectorIT extends AbstractIT {containerSuite.getTrinoContainer().executeUpdateSQL(sql3);// Verify in Gravitino Server- NameIdentifier idTable1 =- NameIdentifier.of(metalakeName, catalogName, databaseName, scenarioTab1Name);+ NameIdentifier idTable1 = NameIdentifier.of(databaseName, scenarioTab1Name);Table table1 = catalog.asTableCatalog().loadTable(idTable1);Assertions.assertEquals(table1.name(), scenarioTab1Name);@@ -275,8 +274,7 @@ public class TrinoConnectorIT extends AbstractIT {containerSuite.getTrinoContainer().executeUpdateSQL(sql4);// Verify in Gravitino Server- NameIdentifier idTable2 =- NameIdentifier.of(metalakeName, catalogName, databaseName, scenarioTab2Name);+ NameIdentifier idTable2 = NameIdentifier.of(databaseName, scenarioTab2Name);Table table2 = catalog.asTableCatalog().loadTable(idTable2);Assertions.assertEquals(table2.name(), scenarioTab2Name);@@ -380,10 +378,7 @@ public class TrinoConnectorIT extends AbstractIT {catalogName, schemaName, tableName);containerSuite.getTrinoContainer().executeUpdateSQL(createTableSql);- Table table =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ Table table = catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));Assertions.assertEquals("123455", table.properties().get("serde-name"));Assertions.assertEquals("hdfs://localhost:9000/user/hive/warehouse/hive_schema.db/hive_table",@@ -651,9 +646,7 @@ public class TrinoConnectorIT extends AbstractIT {"insert into %s.%s.%s values(null, null)",catalogName, schemaName, tableName)));- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));}@Test@@ -691,7 +684,7 @@ public class TrinoConnectorIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),createHiveFullTypeColumns(),"Created by gravitino client",ImmutableMap.<String, String>builder()@@ -712,10 +705,7 @@ public class TrinoConnectorIT extends AbstractIT {});LOG.info("create table \"{}.{}\".{}.{}", metalakeName, catalogName, schemaName, tableName);- Table table =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ Table table = catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));Assertions.assertNotNull(table);String sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName);@@ -913,7 +903,7 @@ public class TrinoConnectorIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),createIcebergFullTypeColumns(),"Created by gravitino client",ImmutableMap.<String, String>builder()@@ -930,10 +920,7 @@ public class TrinoConnectorIT extends AbstractIT {});LOG.info("create table \"{}.{}\".{}.{}", metalakeName, catalogName, schemaName, tableName);- Table table =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ Table table = catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));Assertions.assertNotNull(table);String sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName);@@ -957,11 +944,7 @@ public class TrinoConnectorIT extends AbstractIT {catalogName, schemaName, tableCreatedByTrino);containerSuite.getTrinoContainer().executeUpdateSQL(createTableSql);- table =- catalog- .asTableCatalog()- .loadTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableCreatedByTrino));+ table = catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableCreatedByTrino));Arrays.stream(table.partitioning()).anyMatch(p -> ((Transform.SingleFieldTransform) p).fieldName()[0].equals("name"));@@ -983,10 +966,7 @@ public class TrinoConnectorIT extends AbstractIT {"CREATE TABLE %s.%s.%s (id int, name varchar)", catalogName, schemaName, tableName);containerSuite.getTrinoContainer().executeUpdateSQL(createTableSql);- Table table =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ Table table = catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));Assertions.assertNotNull(table);}@@ -1167,16 +1147,13 @@ public class TrinoConnectorIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),createMySQLFullTypeColumns(),"Created by gravitino client",ImmutableMap.<String, String>builder().build());LOG.info("create table \"{}.{}\".{}.{}", metalakeName, catalogName, schemaName, tableName);- Table table =- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ Table table = catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));Assertions.assertNotNull(table);sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName);@@ -1203,7 +1180,7 @@ public class TrinoConnectorIT extends AbstractIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),columns,"Created by gravitino client",ImmutableMap.<String, String>builder().build(),@@ -1291,9 +1268,7 @@ public class TrinoConnectorIT extends AbstractIT {catalogName, schemaName, tableName);containerSuite.getTrinoContainer().executeUpdateSQL(sql);- catalog- .asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, schemaName, tableName));+ catalog.asTableCatalog().loadTable(NameIdentifier.of(schemaName, tableName));sql = String.format("show create table %s.%s.%s", catalogName, schemaName, tableName);diff --git a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/trino/TrinoQueryITBase.java b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/trino/TrinoQueryITBase.javaindex 854dc1f4bb..1517165f03 100644--- a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/trino/TrinoQueryITBase.java+++ b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/trino/TrinoQueryITBase.java@@ -7,6 +7,7 @@ package com.datastrato.gravitino.integration.test.trino;import static java.lang.Thread.sleep;import com.datastrato.gravitino.Catalog;+import com.datastrato.gravitino.Namespace;import com.datastrato.gravitino.SupportsSchemas;import com.datastrato.gravitino.client.GravitinoAdminClient;import com.datastrato.gravitino.client.GravitinoMetalake;@@ -16,7 +17,6 @@ import com.datastrato.gravitino.integration.test.container.TrinoITContainers;import com.datastrato.gravitino.integration.test.util.AbstractIT;import com.datastrato.gravitino.rel.TableCatalog;import com.datastrato.gravitino.utils.NameIdentifierUtil;-import com.datastrato.gravitino.utils.NamespaceUtil;import java.io.File;import java.io.IOException;import java.nio.charset.StandardCharsets;@@ -189,9 +189,7 @@ public class TrinoQueryITBase {schema -> {try {TableCatalog tableCatalog = catalog.asTableCatalog();- Arrays.stream(- tableCatalog.listTables(- NamespaceUtil.ofTable(metalakeName, catalogName, schema)))+ Arrays.stream(tableCatalog.listTables(Namespace.of(schema))).forEach(table -> {boolean dropped =diff --git a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/CatalogsPageDorisTest.java b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/CatalogsPageDorisTest.javaindex 20441168ce..65acd19862 100644--- a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/CatalogsPageDorisTest.java+++ b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/CatalogsPageDorisTest.java@@ -113,7 +113,7 @@ public class CatalogsPageDorisTest extends AbstractWebIT {catalog_doris.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),new Column[] {column},"comment",properties,diff --git a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/CatalogsPageTest.java b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/CatalogsPageTest.javaindex 7c37734476..88d182b354 100644--- a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/CatalogsPageTest.java+++ b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/CatalogsPageTest.java@@ -149,7 +149,7 @@ public class CatalogsPageTest extends AbstractWebIT {catalog.asTableCatalog().createTable(- NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ NameIdentifier.of(schemaName, tableName),columns,"comment",properties,diff --git a/spark-connector/spark-common/src/main/java/com/datastrato/gravitino/spark/connector/catalog/BaseCatalog.java b/spark-connector/spark-common/src/main/java/com/datastrato/gravitino/spark/connector/catalog/BaseCatalog.javaindex a4c5a4f550..dd74d7bd28 100644--- a/spark-connector/spark-common/src/main/java/com/datastrato/gravitino/spark/connector/catalog/BaseCatalog.java+++ b/spark-connector/spark-common/src/main/java/com/datastrato/gravitino/spark/connector/catalog/BaseCatalog.java@@ -67,13 +67,11 @@ public abstract class BaseCatalog implements TableCatalog, SupportsNamespaces {// The Gravitino catalog client to do schema operations.private Catalog gravitinoCatalogClient;- private final String metalakeName;private String catalogName;private final GravitinoCatalogManager gravitinoCatalogManager;protected BaseCatalog() {gravitinoCatalogManager = GravitinoCatalogManager.get();- metalakeName = gravitinoCatalogManager.getMetalakeName();}/**@@ -164,9 +162,7 @@ public abstract class BaseCatalog implements TableCatalog, SupportsNamespaces {}try {NameIdentifier[] identifiers =- gravitinoCatalogClient- .asTableCatalog()- .listTables(Namespace.of(metalakeName, catalogName, gravitinoNamespace));+ gravitinoCatalogClient.asTableCatalog().listTables(Namespace.of(gravitinoNamespace));return Arrays.stream(identifiers).map(identifier ->@@ -181,8 +177,7 @@ public abstract class BaseCatalog implements TableCatalog, SupportsNamespaces {public Table createTable(Identifier ident, StructType schema, Transform[] transforms, Map<String, String> properties)throws TableAlreadyExistsException, NoSuchNamespaceException {- NameIdentifier gravitinoIdentifier =- NameIdentifier.of(metalakeName, catalogName, getDatabase(ident), ident.name());+ NameIdentifier gravitinoIdentifier = NameIdentifier.of(getDatabase(ident), ident.name());com.datastrato.gravitino.rel.Column[] gravitinoColumns =Arrays.stream(schema.fields()).map(structField -> createGravitinoColumn(structField))@@ -256,8 +251,7 @@ public abstract class BaseCatalog implements TableCatalog, SupportsNamespaces {gravitinoCatalogClient.asTableCatalog().alterTable(- NameIdentifier.of(metalakeName, catalogName, getDatabase(ident), ident.name()),- gravitinoTableChanges);+ NameIdentifier.of(getDatabase(ident), ident.name()), gravitinoTableChanges);org.apache.spark.sql.connector.catalog.Table sparkTable = loadSparkTable(ident);return createSparkTable(ident,@@ -276,14 +270,14 @@ public abstract class BaseCatalog implements TableCatalog, SupportsNamespaces {public boolean dropTable(Identifier ident) {return gravitinoCatalogClient.asTableCatalog()- .dropTable(NameIdentifier.of(metalakeName, catalogName, getDatabase(ident), ident.name()));+ .dropTable(NameIdentifier.of(getDatabase(ident), ident.name()));}@Overridepublic boolean purgeTable(Identifier ident) {return gravitinoCatalogClient.asTableCatalog()- .purgeTable(NameIdentifier.of(metalakeName, catalogName, getDatabase(ident), ident.name()));+ .purgeTable(NameIdentifier.of(getDatabase(ident), ident.name()));}@Override@@ -298,9 +292,7 @@ public abstract class BaseCatalog implements TableCatalog, SupportsNamespaces {try {gravitinoCatalogClient.asTableCatalog()- .alterTable(- NameIdentifier.of(metalakeName, catalogName, getDatabase(oldIdent), oldIdent.name()),- rename);+ .alterTable(NameIdentifier.of(getDatabase(oldIdent), oldIdent.name()), rename);} catch (com.datastrato.gravitino.exceptions.NoSuchTableException e) {throw new NoSuchTableException(oldIdent);}@@ -395,7 +387,7 @@ public abstract class BaseCatalog implements TableCatalog, SupportsNamespaces {String database = getDatabase(ident);return gravitinoCatalogClient.asTableCatalog()- .loadTable(NameIdentifier.of(metalakeName, catalogName, database, ident.name()));+ .loadTable(NameIdentifier.of(database, ident.name()));} catch (com.datastrato.gravitino.exceptions.NoSuchTableException e) {throw new NoSuchTableException(ident);}@@ -436,9 +428,9 @@ public abstract class BaseCatalog implements TableCatalog, SupportsNamespaces {private String getDatabase(NameIdentifier gravitinoIdentifier) {Preconditions.checkArgument(- gravitinoIdentifier.namespace().length() == 3,- "Only support 3 level namespace," + gravitinoIdentifier.namespace());- return gravitinoIdentifier.namespace().level(2);+ gravitinoIdentifier.namespace().length() == 1,+ "Only support 1 level namespace," + gravitinoIdentifier.namespace());+ return gravitinoIdentifier.namespace().level(0);}private Table loadSparkTable(Identifier ident) {diff --git a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/CatalogConnectorMetadata.java b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/CatalogConnectorMetadata.javaindex aef0aa2296..552c405d87 100644--- a/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/CatalogConnectorMetadata.java+++ b/trino-connector/src/main/java/com/datastrato/gravitino/trino/connector/catalog/CatalogConnectorMetadata.java@@ -46,7 +46,6 @@ public class CatalogConnectorMetadata {private static final String CATALOG_DOES_NOT_EXIST_MSG = "Catalog does not exist";private static final String SCHEMA_DOES_NOT_EXIST_MSG = "Schema does not exist";- private final GravitinoMetalake metalake;private final String catalogName;private final SupportsSchemas schemaCatalog;private final TableCatalog tableCatalog;@@ -54,7 +53,6 @@ public class CatalogConnectorMetadata {public CatalogConnectorMetadata(GravitinoMetalake metalake, NameIdentifier catalogIdentifier) {try {this.catalogName = catalogIdentifier.name();- this.metalake = metalake;Catalog catalog = metalake.loadCatalog(catalogName);// Make sure the catalog support schema operations.this.schemaCatalog = catalog.asSchemas();@@ -88,9 +86,7 @@ public class CatalogConnectorMetadata {public GravitinoTable getTable(String schemaName, String tableName) {try {- Table table =- tableCatalog.loadTable(- NameIdentifier.of(metalake.name(), catalogName, schemaName, tableName));+ Table table = tableCatalog.loadTable(NameIdentifier.of(schemaName, tableName));return new GravitinoTable(schemaName, tableName, table);} catch (NoSuchTableException e) {throw new TrinoException(GRAVITINO_TABLE_NOT_EXISTS, "Table does not exist", e);@@ -99,8 +95,7 @@ public class CatalogConnectorMetadata {public List<String> listTables(String schemaName) {try {- NameIdentifier[] tables =- tableCatalog.listTables(Namespace.of(metalake.name(), catalogName, schemaName));+ NameIdentifier[] tables = tableCatalog.listTables(Namespace.of(schemaName));return Arrays.stream(tables).map(NameIdentifier::name).toList();} catch (NoSuchSchemaException e) {throw new TrinoException(GRAVITINO_SCHEMA_NOT_EXISTS, SCHEMA_DOES_NOT_EXIST_MSG, e);@@ -108,13 +103,11 @@ public class CatalogConnectorMetadata {}public boolean tableExists(String schemaName, String tableName) {- return tableCatalog.tableExists(- NameIdentifier.of(metalake.name(), catalogName, schemaName, tableName));+ return tableCatalog.tableExists(NameIdentifier.of(schemaName, tableName));}public void createTable(GravitinoTable table, boolean ignoreExisting) {- NameIdentifier identifier =- NameIdentifier.of(metalake.name(), catalogName, table.getSchemaName(), table.getName());+ NameIdentifier identifier = NameIdentifier.of(table.getSchemaName(), table.getName());try {tableCatalog.createTable(identifier,@@ -159,8 +152,7 @@ public class CatalogConnectorMetadata {public void dropTable(SchemaTableName tableName) {boolean dropped =tableCatalog.dropTable(- NameIdentifier.of(- metalake.name(), catalogName, tableName.getSchemaName(), tableName.getTableName()));+ NameIdentifier.of(tableName.getSchemaName(), tableName.getTableName()));if (!dropped) {throw new TrinoException(GRAVITINO_OPERATION_FAILED, "Failed to drop table " + tableName);}@@ -173,9 +165,7 @@ public class CatalogConnectorMetadata {private void applyAlter(SchemaTableName tableName, TableChange... change) {try {tableCatalog.alterTable(- NameIdentifier.of(- metalake.name(), catalogName, tableName.getSchemaName(), tableName.getTableName()),- change);+ NameIdentifier.of(tableName.getSchemaName(), tableName.getTableName()), change);} catch (NoSuchTableException e) {throw new TrinoException(GRAVITINO_TABLE_NOT_EXISTS, "Table does not exist");} catch (IllegalArgumentException e) {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 875621c799..febfcdf753 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@@ -405,12 +405,7 @@ public class GravitinoMockServer implements AutoCloseable {ConnectorMetadata metadata = memoryConnector.getMetadata(null, null);ArrayList<NameIdentifier> tableNames = new ArrayList<>();for (SchemaTableName tableName : metadata.listTables(null, Optional.empty())) {- tableNames.add(- NameIdentifier.of(- schemaName.level(0),- schemaName.level(1),- schemaName.level(2),- tableName.getTableName()));+ tableNames.add(NameIdentifier.of(schemaName.level(0), tableName.getTableName()));}return tableNames.toArray(new NameIdentifier[tableNames.size()]);}@@ -593,13 +588,13 @@ public class GravitinoMockServer implements AutoCloseable {TableName(NameIdentifier nameIdentifier) {Preconditions.checkArgument(- nameIdentifier.namespace().length() == 3,+ nameIdentifier.namespace().length() == 1,"Not a table nameIdentifier: " + nameIdentifier);this.nameIdentifier = nameIdentifier;}String schema() {- return nameIdentifier.namespace().level(2);+ return nameIdentifier.namespace().level(0);}String table() {