World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#90] feat(hive-catalog): Support partition in Hive catalog (#387)
mchades170cc5dd1330
diff --git a/api/src/main/java/com/datastrato/graviton/rel/transforms/Transforms.java b/api/src/main/java/com/datastrato/graviton/rel/transforms/Transforms.javaindex 76630cbcd9..3a45d5138a 100644--- a/api/src/main/java/com/datastrato/graviton/rel/transforms/Transforms.java+++ b/api/src/main/java/com/datastrato/graviton/rel/transforms/Transforms.java@@ -30,6 +30,16 @@ public class Transforms {return field(fieldName);}+ /**+ * Creates a partitioning by given column's name.+ *+ * @param column The column to partition by.+ * @return The identity partitioning.+ */+ public static NamedReference identity(Column column) {+ return field(new String[] {column.name()});+ }+/*** Creates a partitioning by extract a date or timestamp year value.*diff --git a/catalog-hive/src/main/java/com/datastrato/graviton/catalog/hive/HiveCatalogOperations.java b/catalog-hive/src/main/java/com/datastrato/graviton/catalog/hive/HiveCatalogOperations.javaindex 87bf768f7f..d2300183b7 100644--- a/catalog-hive/src/main/java/com/datastrato/graviton/catalog/hive/HiveCatalogOperations.java+++ b/catalog-hive/src/main/java/com/datastrato/graviton/catalog/hive/HiveCatalogOperations.java@@ -35,11 +35,13 @@ import com.datastrato.graviton.rel.Table;import com.datastrato.graviton.rel.TableCatalog;import com.datastrato.graviton.rel.TableChange;import com.datastrato.graviton.rel.transforms.Transform;+import com.datastrato.graviton.rel.transforms.Transforms;import com.google.common.annotations.VisibleForTesting;import com.google.common.base.Preconditions;import com.google.common.collect.Lists;import java.io.IOException;import java.time.Instant;+import java.util.Arrays;import java.util.List;import java.util.Map;import java.util.stream.Collectors;@@ -605,6 +607,10 @@ public class HiveCatalogOperations implements CatalogOperations, SupportsSchemasString.format("Cannot support invalid namespace in Hive Metastore: %s", schemaIdent.namespace()));+ Preconditions.checkArgument(+ Arrays.stream(partitions).allMatch(p -> p instanceof Transforms.NamedReference),+ "Hive partition only supports identity transform");+try {if (!schemaExists(schemaIdent)) {LOG.warn("Hive schema (database) does not exist: {}", schemaIdent);@@ -631,6 +637,7 @@ public class HiveCatalogOperations implements CatalogOperations, SupportsSchemas.withCreator(currentUser()).withCreateTime(Instant.now()).build())+ .withPartitions(partitions).build();store.put(createdTable, false);clientPool.run(diff --git a/catalog-hive/src/main/java/com/datastrato/graviton/catalog/hive/HiveTable.java b/catalog-hive/src/main/java/com/datastrato/graviton/catalog/hive/HiveTable.javaindex e9752e1baa..81485e5cf5 100644--- a/catalog-hive/src/main/java/com/datastrato/graviton/catalog/hive/HiveTable.java+++ b/catalog-hive/src/main/java/com/datastrato/graviton/catalog/hive/HiveTable.java@@ -4,6 +4,7 @@*/package com.datastrato.graviton.catalog.hive;+import static com.datastrato.graviton.rel.transforms.Transforms.identity;import static org.apache.hadoop.hive.metastore.TableType.EXTERNAL_TABLE;import static org.apache.hadoop.hive.metastore.TableType.MANAGED_TABLE;@@ -12,11 +13,14 @@ import com.datastrato.graviton.catalog.hive.converter.FromHiveType;import com.datastrato.graviton.catalog.hive.converter.ToHiveType;import com.datastrato.graviton.meta.AuditInfo;import com.datastrato.graviton.meta.rel.BaseTable;-import com.google.common.collect.Lists;+import com.datastrato.graviton.rel.Column;+import com.datastrato.graviton.rel.transforms.Transforms;+import com.google.common.base.Preconditions;import com.google.common.collect.Maps;import com.google.common.collect.Sets;import java.time.Instant;import java.util.Arrays;+import java.util.List;import java.util.Optional;import java.util.Set;import java.util.stream.Collectors;@@ -74,6 +78,10 @@ public class HiveTable extends BaseTable {.toArray(HiveColumn[]::new)).withLocation(table.getSd().getLocation()).withAuditInfo(auditInfoBuilder.build())+ .withPartitions(+ table.getPartitionKeys().stream()+ .map(p -> identity(new String[] {p.getName()}))+ .toArray(Transforms.NamedReference[]::new)).build();}@@ -89,7 +97,7 @@ public class HiveTable extends BaseTable {hiveTable.setDbName(schemaIdentifier().name());hiveTable.setSd(buildStorageDescriptor());hiveTable.setParameters(properties);- hiveTable.setPartitionKeys(Lists.newArrayList() /* TODO(Minghuang): Add partition support */);+ hiveTable.setPartitionKeys(buildPartitionKeys());// Set AuditInfo to Hive's Table object. Hive's Table doesn't support setting last modifier// and last modified time, so we only set creator and create time.@@ -99,6 +107,27 @@ public class HiveTable extends BaseTable {return hiveTable;}+ private List<FieldSchema> buildPartitionKeys() {+ return Arrays.stream(partitions)+ .map(p -> getPartitionKey(((Transforms.NamedReference) p).value()))+ .collect(Collectors.toList());+ }++ private FieldSchema getPartitionKey(String[] fieldName) {+ Preconditions.checkArgument(+ fieldName.length == 1, "Hive partition does not support nested field");+ List<Column> partitionColumns =+ Arrays.stream(columns)+ .filter(c -> c.name().equals(fieldName[0]))+ .collect(Collectors.toList());+ Preconditions.checkArgument(+ partitionColumns.size() == 1, "Hive partition must match one column");+ return new FieldSchema(+ partitionColumns.get(0).name(),+ partitionColumns.get(0).dataType().accept(ToHiveType.INSTANCE).getQualifiedName(),+ partitionColumns.get(0).comment());+ }+private StorageDescriptor buildStorageDescriptor() {StorageDescriptor sd = new StorageDescriptor();sd.setCols(@@ -165,6 +194,7 @@ public class HiveTable extends BaseTable {hiveTable.auditInfo = auditInfo;hiveTable.columns = columns;hiveTable.location = location;+ hiveTable.partitions = partitions;// HMS put table comment in parametersif (comment != null) {diff --git a/catalog-hive/src/test/java/com/datastrato/graviton/catalog/hive/TestHiveTable.java b/catalog-hive/src/test/java/com/datastrato/graviton/catalog/hive/TestHiveTable.javaindex 627dea1090..ccf296ebaa 100644--- a/catalog-hive/src/test/java/com/datastrato/graviton/catalog/hive/TestHiveTable.java+++ b/catalog-hive/src/test/java/com/datastrato/graviton/catalog/hive/TestHiveTable.java@@ -9,6 +9,8 @@ import static com.datastrato.graviton.Configs.ENTITY_KV_STORE;import static com.datastrato.graviton.Configs.ENTITY_STORE;import static com.datastrato.graviton.Configs.ENTRY_KV_ROCKSDB_BACKEND_PATH;import static com.datastrato.graviton.Entity.EntityType.TABLE;+import static com.datastrato.graviton.rel.transforms.Transforms.day;+import static com.datastrato.graviton.rel.transforms.Transforms.identity;import com.datastrato.graviton.Config;import com.datastrato.graviton.Configs;@@ -184,6 +186,98 @@ public class TestHiveTable extends MiniHiveMetastoreService {Assertions.assertTrue(exception.getMessage().contains("Table already exists"));}+ @Test+ public void testCreatePartitionedHiveTable() throws IOException {+ NameIdentifier tableIdentifier =+ NameIdentifier.of(META_LAKE_NAME, hiveCatalog.name(), hiveSchema.name(), genRandomName());+ Map<String, String> properties = Maps.newHashMap();+ properties.put("key1", "val1");+ properties.put("key2", "val2");++ HiveColumn col1 =+ new HiveColumn.Builder()+ .withName("city")+ .withType(TypeCreator.NULLABLE.I8)+ .withComment(HIVE_COMMENT)+ .build();+ HiveColumn col2 =+ new HiveColumn.Builder()+ .withName("dt")+ .withType(TypeCreator.NULLABLE.DATE)+ .withComment(HIVE_COMMENT)+ .build();+ Column[] columns = new Column[] {col1, col2};++ Transform[] partitions = new Transform[] {identity(new String[] {col1.name()})};++ Table table =+ hiveCatalog+ .asTableCatalog()+ .createTable(tableIdentifier, columns, HIVE_COMMENT, properties, partitions);+ Assertions.assertEquals(tableIdentifier.name(), table.name());+ Assertions.assertEquals(HIVE_COMMENT, table.comment());+ testProperties(properties, table.properties());+ Assertions.assertArrayEquals(partitions, table.partitioning());++ Table loadedTable = hiveCatalog.asTableCatalog().loadTable(tableIdentifier);+ Assertions.assertEquals(table.auditInfo(), loadedTable.auditInfo());+ testProperties(properties, loadedTable.properties());+ Assertions.assertArrayEquals(partitions, loadedTable.partitioning());++ Assertions.assertTrue(hiveCatalog.asTableCatalog().tableExists(tableIdentifier));+ NameIdentifier[] tableIdents =+ hiveCatalog.asTableCatalog().listTables(tableIdentifier.namespace());+ Assertions.assertTrue(Arrays.asList(tableIdents).contains(tableIdentifier));+ Assertions.assertTrue(store.exists(tableIdentifier, TABLE));++ // Test exception+ Throwable exception =+ Assertions.assertThrows(+ IllegalArgumentException.class,+ () ->+ hiveCatalog+ .asTableCatalog()+ .createTable(+ tableIdentifier,+ columns,+ HIVE_COMMENT,+ properties,+ new Transform[] {day(new String[] {col2.name()})}));+ Assertions.assertTrue(+ exception.getMessage().contains("Hive partition only supports identity transform"));++ exception =+ Assertions.assertThrows(+ RuntimeException.class,+ () ->+ hiveCatalog+ .asTableCatalog()+ .createTable(+ NameIdentifier.of(+ META_LAKE_NAME, hiveCatalog.name(), hiveSchema.name(), genRandomName()),+ columns,+ HIVE_COMMENT,+ properties,+ new Transform[] {identity(new String[] {col1.name(), col2.name()})}));+ Assertions.assertTrue(+ exception.getMessage().contains("Hive partition does not support nested field"));++ exception =+ Assertions.assertThrows(+ RuntimeException.class,+ () ->+ hiveCatalog+ .asTableCatalog()+ .createTable(+ NameIdentifier.of(+ META_LAKE_NAME, hiveCatalog.name(), hiveSchema.name(), genRandomName()),+ columns,+ HIVE_COMMENT,+ properties,+ new Transform[] {identity(new String[] {"not_exist_field"})}));+ Assertions.assertTrue(exception.getMessage().contains("Hive partition must match one column"));+ }+@Testpublic void testDropHiveTable() throws IOException {NameIdentifier tableIdentifier =@@ -304,6 +398,8 @@ public class TestHiveTable extends MiniHiveMetastoreService {createdTable.auditInfo().createTime(), alteredTable.auditInfo().createTime());Assertions.assertNotNull(alteredTable.auditInfo().lastModifier());Assertions.assertNotNull(alteredTable.auditInfo().lastModifiedTime());+ Assertions.assertNotNull(alteredTable.partitioning());+ Assertions.assertArrayEquals(createdTable.partitioning(), alteredTable.partitioning());Column[] expected =new Column[] {@@ -345,6 +441,8 @@ public class TestHiveTable extends MiniHiveMetastoreService {createdTable.auditInfo().createTime(), alteredTable1.auditInfo().createTime());Assertions.assertNotNull(alteredTable1.auditInfo().lastModifier());Assertions.assertNotNull(alteredTable1.auditInfo().lastModifiedTime());+ Assertions.assertNotNull(alteredTable.partitioning());+ Assertions.assertArrayEquals(createdTable.partitioning(), alteredTable.partitioning());}private void testProperties(Map<String, String> expectedProps, Map<String, String> testProps) {diff --git a/common/src/main/java/com/datastrato/graviton/dto/responses/TableResponse.java b/common/src/main/java/com/datastrato/graviton/dto/responses/TableResponse.javaindex f90881a1ac..47c9e153fc 100644--- a/common/src/main/java/com/datastrato/graviton/dto/responses/TableResponse.java+++ b/common/src/main/java/com/datastrato/graviton/dto/responses/TableResponse.java@@ -42,8 +42,7 @@ public class TableResponse extends BaseResponse {table.columns() != null && table.columns().length > 0,"table 'columns' must not be null and empty");Preconditions.checkArgument(table.auditInfo() != null, "table 'audit' must not be null");- // TODO(minghuang): Please fix this bug- // Preconditions.checkArgument(- // table.partitioning() != null, "table 'partitions' must not be null");+ Preconditions.checkArgument(+ table.partitioning() != null, "table 'partitions' must not be null");}}diff --git a/integration-test/src/test/java/com/datastrato/graviton/integration/e2e/CatalogHiveIT.java b/integration-test/src/test/java/com/datastrato/graviton/integration/e2e/CatalogHiveIT.javaindex 66711d023d..6813893489 100644--- a/integration-test/src/test/java/com/datastrato/graviton/integration/e2e/CatalogHiveIT.java+++ b/integration-test/src/test/java/com/datastrato/graviton/integration/e2e/CatalogHiveIT.java@@ -4,6 +4,7 @@*/package com.datastrato.graviton.integration.e2e;+import static com.datastrato.graviton.rel.transforms.Transforms.identity;import static org.junit.jupiter.api.Assertions.assertThrows;import com.datastrato.graviton.Catalog;@@ -13,21 +14,29 @@ import com.datastrato.graviton.client.GravitonMetaLake;import com.datastrato.graviton.dto.rel.ColumnDTO;import com.datastrato.graviton.integration.util.AbstractIT;import com.datastrato.graviton.integration.util.GravitonITUtils;+import com.datastrato.graviton.rel.Schema;import com.datastrato.graviton.rel.SchemaChange;+import com.datastrato.graviton.rel.Table;import com.datastrato.graviton.rel.TableChange;+import com.datastrato.graviton.rel.transforms.Transform;+import com.datastrato.graviton.rel.transforms.Transforms;import com.google.common.collect.Maps;import io.substrait.type.TypeCreator;+import java.util.Arrays;import java.util.Collections;+import java.util.List;import java.util.Map;+import java.util.stream.Collectors;import org.apache.hadoop.hive.conf.HiveConf;import org.apache.hadoop.hive.metastore.api.Database;+import org.apache.hadoop.hive.metastore.api.FieldSchema;import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;import org.apache.thrift.TException;import org.junit.jupiter.api.AfterAll;+import org.junit.jupiter.api.AfterEach;import org.junit.jupiter.api.Assertions;import org.junit.jupiter.api.BeforeAll;import org.junit.jupiter.api.MethodOrderer;-import org.junit.jupiter.api.Order;import org.junit.jupiter.api.Test;import org.junit.jupiter.api.TestMethodOrder;@@ -47,16 +56,19 @@ public class CatalogHiveIT extends AbstractIT {private static HiveClientPool hiveClientPool;+ private static GravitonMetaLake metalake;++ private static Catalog catalog;+@BeforeAllpublic static void startup() throws Exception {HiveConf hiveConf = new HiveConf();hiveConf.set(HiveConf.ConfVars.METASTOREURIS.varname, HIVE_METASTORE_URIS);-- GravitonMetaLake[] gravitonMetaLakes = client.listMetalakes();-hiveClientPool = new HiveClientPool(1, hiveConf);- client.createMetalake(NameIdentifier.of(metalakeName), "comment", Collections.emptyMap());- createHiveTable();++ createMetalake();+ createCatalog();+ createSchema();}@AfterAll@@ -67,10 +79,28 @@ public class CatalogHiveIT extends AbstractIT {}}- public static void createHiveTable() throws TException, InterruptedException {- GravitonMetaLake metalake = client.loadMetalake(NameIdentifier.of(metalakeName));+ @AfterEach+ private void resetSchema() throws TException, InterruptedException {+ catalog.asSchemas().dropSchema(NameIdentifier.of(metalakeName, catalogName, schemaName), true);+ assertThrows(+ NoSuchObjectException.class,+ () -> hiveClientPool.run(client -> client.getDatabase(schemaName)));+ createSchema();+ }++ private static void createMetalake() {+ GravitonMetaLake[] gravitonMetaLakes = client.listMetalakes();+ Assertions.assertEquals(0, gravitonMetaLakes.length);++ GravitonMetaLake createdMetalake =+ client.createMetalake(NameIdentifier.of(metalakeName), "comment", Collections.emptyMap());+ GravitonMetaLake loadMetalake = client.loadMetalake(NameIdentifier.of(metalakeName));+ Assertions.assertEquals(createdMetalake, loadMetalake);++ metalake = loadMetalake;+ }- // Create catalog from Graviton API+ private static void createCatalog() {Map<String, String> properties = Maps.newHashMap();properties.put("provider", "hive");properties.put(HiveConf.ConfVars.METASTOREURIS.varname, HIVE_METASTORE_URIS);@@ -78,20 +108,28 @@ public class CatalogHiveIT extends AbstractIT {properties.put(HiveConf.ConfVars.METASTORETHRIFTFAILURERETRIES.varname, "30");properties.put(HiveConf.ConfVars.METASTORE_CLIENT_CONNECT_RETRY_DELAY.varname, "5");- Catalog catalog =+ Catalog createdCatalog =metalake.createCatalog(NameIdentifier.of(metalakeName, catalogName),Catalog.Type.RELATIONAL,"comment",properties);+ Catalog loadCatalog = metalake.loadCatalog(NameIdentifier.of(metalakeName, catalogName));+ Assertions.assertEquals(createdCatalog, loadCatalog);+ catalog = loadCatalog;+ }++ private static void createSchema() throws TException, InterruptedException {NameIdentifier ident = NameIdentifier.of(metalakeName, catalogName, schemaName);Map<String, String> properties1 = Maps.newHashMap();properties1.put("key1", "val1");properties1.put("key2", "val2");String comment = "comment";- catalog.asSchemas().createSchema(ident, comment, properties1);+ Schema createdSchema = catalog.asSchemas().createSchema(ident, comment, properties1);+ Schema loadSchema = catalog.asSchemas().loadSchema(ident);+ Assertions.assertEquals(createdSchema.name().toLowerCase(), loadSchema.name());// Directly get database from hive metastore to verify the schema creationDatabase database = hiveClientPool.run(client -> client.getDatabase(schemaName));@@ -99,8 +137,9 @@ public class CatalogHiveIT extends AbstractIT {Assertions.assertEquals(comment, database.getDescription());Assertions.assertEquals("val1", database.getParameters().get("key1"));Assertions.assertEquals("val2", database.getParameters().get("key2"));+ }- // Create table from Graviton API+ private ColumnDTO[] createColumns() {ColumnDTO col1 =new ColumnDTO.Builder().withName(HIVE_COL_NAME1)@@ -119,18 +158,86 @@ public class CatalogHiveIT extends AbstractIT {.withDataType(TypeCreator.NULLABLE.STRING).withComment("col_3_comment").build();- ColumnDTO[] columns = new ColumnDTO[] {col1, col2, col3};+ return new ColumnDTO[] {col1, col2, col3};+ }++ private Map<String, String> createProperties() {+ Map<String, String> properties = Maps.newHashMap();+ properties.put("key1", "val1");+ properties.put("key2", "val2");+ return properties;+ }++ @Test+ public void testCreateHiveTable() throws TException, InterruptedException {+ // Create table from Graviton API+ ColumnDTO[] columns = createColumns();++ NameIdentifier nameIdentifier =+ NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);+ Map<String, String> properties = createProperties();+ Table createdTable =+ catalog+ .asTableCatalog()+ .createTable(nameIdentifier, columns, table_comment, properties, new Transform[0]);++ // Directly get table from hive metastore to check if the table is created successfully.+ org.apache.hadoop.hive.metastore.api.Table hiveTab =+ hiveClientPool.run(client -> client.getTable(schemaName, tableName));+ properties+ .keySet()+ .forEach(+ key -> Assertions.assertEquals(properties.get(key), hiveTab.getParameters().get(key)));+ assertTableEquals(createdTable, hiveTab);++ // test null partition+ resetSchema();+ Table createdTable1 =+ catalog+ .asTableCatalog()+ .createTable(nameIdentifier, columns, table_comment, properties, null);++ // Directly get table from hive metastore to check if the table is created successfully.+ org.apache.hadoop.hive.metastore.api.Table hiveTable1 =+ hiveClientPool.run(client -> client.getTable(schemaName, tableName));+ properties+ .keySet()+ .forEach(+ key ->+ Assertions.assertEquals(properties.get(key), hiveTable1.getParameters().get(key)));+ assertTableEquals(createdTable1, hiveTable1);+ }++ @Test+ public void testCreatePartitionedHiveTable() throws TException, InterruptedException {+ // Create table from Graviton API+ ColumnDTO[] columns = createColumns();NameIdentifier nameIdentifier =NameIdentifier.of(metalakeName, catalogName, schemaName, tableName);- Map<String, String> properties2 = Maps.newHashMap();- properties1.put("key2-1", "val1");- properties1.put("key2-2", "val2");- catalog.asTableCatalog().createTable(nameIdentifier, columns, table_comment, properties2);+ Map<String, String> properties = createProperties();+ Table createdTable =+ catalog+ .asTableCatalog()+ .createTable(+ nameIdentifier,+ columns,+ table_comment,+ properties,+ new Transform[] {identity(columns[0]), identity(columns[1])});// Directly get table from hive metastore to check if the table is created successfully.org.apache.hadoop.hive.metastore.api.Table hiveTab =hiveClientPool.run(client -> client.getTable(schemaName, tableName));+ properties+ .keySet()+ .forEach(+ key -> Assertions.assertEquals(properties.get(key), hiveTab.getParameters().get(key)));+ assertTableEquals(createdTable, hiveTab);+ }++ private void assertTableEquals(+ Table createdTable, org.apache.hadoop.hive.metastore.api.Table hiveTab) {Assertions.assertEquals(schemaName.toLowerCase(), hiveTab.getDbName());Assertions.assertEquals(tableName.toLowerCase(), hiveTab.getTableName());Assertions.assertEquals("MANAGED_TABLE", hiveTab.getTableType());@@ -147,13 +254,29 @@ public class CatalogHiveIT extends AbstractIT {Assertions.assertEquals(HIVE_COL_NAME3, hiveTab.getSd().getCols().get(2).getName());Assertions.assertEquals("string", hiveTab.getSd().getCols().get(2).getType());Assertions.assertEquals("col_3_comment", hiveTab.getSd().getCols().get(2).getComment());++ Assertions.assertNotNull(createdTable.partitioning());+ Assertions.assertEquals(createdTable.partitioning().length, hiveTab.getPartitionKeys().size());+ List<String> partitionKeys =+ Arrays.stream(createdTable.partitioning())+ .map(p -> ((Transforms.NamedReference) p).value()[0])+ .collect(Collectors.toList());+ List<String> hivePartitionKeys =+ hiveTab.getPartitionKeys().stream().map(FieldSchema::getName).collect(Collectors.toList());+ Assertions.assertEquals(partitionKeys, hivePartitionKeys);}- @Order(1)@Testpublic void testAlterHiveTable() throws TException, InterruptedException {- GravitonMetaLake metalake = client.loadMetalake(NameIdentifier.of(metalakeName));- Catalog catalog = metalake.loadCatalog(NameIdentifier.of(metalakeName, catalogName));+ ColumnDTO[] columns = createColumns();+ catalog+ .asTableCatalog()+ .createTable(+ NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ columns,+ table_comment,+ createProperties(),+ new Transform[] {identity(columns[0])});catalog.asTableCatalog().alterTable(@@ -188,14 +311,22 @@ public class CatalogHiveIT extends AbstractIT {Assertions.assertEquals("col_4", hiveTab.getSd().getCols().get(3).getName());Assertions.assertEquals("string", hiveTab.getSd().getCols().get(3).getType());- Assertions.assertEquals(null, hiveTab.getSd().getCols().get(3).getComment());+ Assertions.assertNull(hiveTab.getSd().getCols().get(3).getComment());++ Assertions.assertEquals(1, hiveTab.getPartitionKeys().size());+ Assertions.assertEquals(columns[0].name(), hiveTab.getPartitionKeys().get(0).getName());}- @Order(2)@Testpublic void testDropHiveTable() {- GravitonMetaLake metalake = client.loadMetalake(NameIdentifier.of(metalakeName));- Catalog catalog = metalake.loadCatalog(NameIdentifier.of(metalakeName, catalogName));+ catalog+ .asTableCatalog()+ .createTable(+ NameIdentifier.of(metalakeName, catalogName, schemaName, tableName),+ createColumns(),+ table_comment,+ createProperties(),+ new Transform[0]);catalog.asTableCatalog().dropTable(NameIdentifier.of(metalakeName, catalogName, schemaName, alertTableName));@@ -208,7 +339,6 @@ public class CatalogHiveIT extends AbstractIT {// TODO (xun) enable this test waiting for fixed [#316] [Bug report] alterSchema throw// NoSuchSchemaException- // @Order(3)// @Testpublic void testAlterSchema() throws TException, InterruptedException {NameIdentifier ident = NameIdentifier.of(metalakeName, catalogName, schemaName);@@ -237,16 +367,4 @@ public class CatalogHiveIT extends AbstractIT {Assertions.assertFalse(properties3.containsKey("key1"));Assertions.assertEquals("val2-alter", properties3.get("key2"));}-- @Order(4)- @Test- public void testDropHiveDB() {- GravitonMetaLake metalake = client.loadMetalake(NameIdentifier.of(metalakeName));- Catalog catalog = metalake.loadCatalog(NameIdentifier.of(metalakeName, catalogName));- catalog.asSchemas().dropSchema(NameIdentifier.of(metalakeName, catalogName, schemaName), true);-- assertThrows(- NoSuchObjectException.class,- () -> hiveClientPool.run(client -> client.getDatabase(schemaName)));- }}