diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/glue/GlueHiveMetastore.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/glue/GlueHiveMetastore.java index fa145f2a4d20..898f6b579240 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/glue/GlueHiveMetastore.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/glue/GlueHiveMetastore.java @@ -291,7 +291,7 @@ public Optional getDatabase(String databaseName) public List getAllDatabases() { try { - return stats.getGetAllDatabases().call(() -> { + return stats.getGetDatabases().call(() -> { List databaseNames = getPaginatedResults( glueClient::getDatabases, new GetDatabasesRequest().withCatalogId(catalogId), @@ -448,7 +448,7 @@ private void updatePartitionStatisticsBatch(Table table, Map getAllTables(String databaseName) { try { - return stats.getGetAllTables().call(() -> { + return stats.getGetTables().call(() -> { List tableNames = getPaginatedResults( glueClient::getTables, new GetTablesRequest() @@ -548,7 +548,7 @@ public void dropDatabase(String databaseName, boolean deleteData) } try { - stats.getDropDatabase().call(() -> + stats.getDeleteDatabase().call(() -> glueClient.deleteDatabase(new DeleteDatabaseRequest().withCatalogId(catalogId).withName(databaseName))); } catch (EntityNotFoundException e) { @@ -569,7 +569,7 @@ public void renameDatabase(String databaseName, String newDatabaseName) try { Database database = getDatabase(databaseName).orElseThrow(() -> new SchemaNotFoundException(databaseName)); DatabaseInput renamedDatabase = GlueInputConverter.convertDatabase(database).withName(newDatabaseName); - stats.getRenameDatabase().call(() -> + stats.getUpdateDatabase().call(() -> glueClient.updateDatabase(new UpdateDatabaseRequest() .withCatalogId(catalogId) .withName(databaseName) @@ -614,7 +614,7 @@ public void dropTable(String databaseName, String tableName, boolean deleteData) Table table = getExistingTable(databaseName, tableName); try { - stats.getDropTable().call(() -> + stats.getDeleteTable().call(() -> glueClient.deleteTable(new DeleteTableRequest() .withCatalogId(catalogId) .withDatabaseName(databaseName) @@ -651,7 +651,7 @@ public void replaceTable(String databaseName, String tableName, Table newTable, { try { TableInput newTableInput = GlueInputConverter.convertTable(newTable); - stats.getReplaceTable().call(() -> + stats.getUpdateTable().call(() -> glueClient.updateTable(new UpdateTableRequest() .withCatalogId(catalogId) .withDatabaseName(databaseName) @@ -690,7 +690,7 @@ public void setTableOwner(String databaseName, String tableName, HivePrincipal p TableInput newTableInput = GlueInputConverter.convertTable(table); newTableInput.setOwner(principal.getName()); - stats.getReplaceTable().call(() -> + stats.getUpdateTable().call(() -> glueClient.updateTable(new UpdateTableRequest() .withCatalogId(catalogId) .withDatabaseName(databaseName) @@ -960,7 +960,7 @@ private List batchGetPartition(Table table, List partitionNam public void addPartitions(String databaseName, String tableName, List partitions) { try { - stats.getAddPartitions().call(() -> { + stats.getCreatePartitions().call(() -> { List> futures = new ArrayList<>(); for (List partitionBatch : Lists.partition(partitions, BATCH_CREATE_PARTITION_MAX_PAGE_SIZE)) { @@ -1023,7 +1023,7 @@ public void dropPartition(String databaseName, String tableName, List pa .orElseThrow(() -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), parts)); try { - stats.getDropPartition().call(() -> + stats.getDeletePartition().call(() -> glueClient.deletePartition(new DeletePartitionRequest() .withCatalogId(catalogId) .withDatabaseName(databaseName) @@ -1045,7 +1045,7 @@ public void alterPartition(String databaseName, String tableName, PartitionWithS { try { PartitionInput newPartition = convertPartition(partition); - stats.getAlterPartition().call(() -> + stats.getUpdatePartition().call(() -> glueClient.updatePartition(new UpdatePartitionRequest() .withCatalogId(catalogId) .withDatabaseName(databaseName) diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/glue/GlueMetastoreStats.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/glue/GlueMetastoreStats.java index 2a505cafa4c8..718da71fb958 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/glue/GlueMetastoreStats.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/glue/GlueMetastoreStats.java @@ -27,24 +27,24 @@ public class GlueMetastoreStats { - private final GlueMetastoreApiStats getAllDatabases = new GlueMetastoreApiStats(); + private final GlueMetastoreApiStats getDatabases = new GlueMetastoreApiStats(); private final GlueMetastoreApiStats getDatabase = new GlueMetastoreApiStats(); - private final GlueMetastoreApiStats getAllTables = new GlueMetastoreApiStats(); + private final GlueMetastoreApiStats getTables = new GlueMetastoreApiStats(); private final GlueMetastoreApiStats getTable = new GlueMetastoreApiStats(); private final GlueMetastoreApiStats getAllViews = new GlueMetastoreApiStats(); private final GlueMetastoreApiStats createDatabase = new GlueMetastoreApiStats(); - private final GlueMetastoreApiStats dropDatabase = new GlueMetastoreApiStats(); - private final GlueMetastoreApiStats renameDatabase = new GlueMetastoreApiStats(); + private final GlueMetastoreApiStats deleteDatabase = new GlueMetastoreApiStats(); + private final GlueMetastoreApiStats updateDatabase = new GlueMetastoreApiStats(); private final GlueMetastoreApiStats createTable = new GlueMetastoreApiStats(); - private final GlueMetastoreApiStats dropTable = new GlueMetastoreApiStats(); - private final GlueMetastoreApiStats replaceTable = new GlueMetastoreApiStats(); + private final GlueMetastoreApiStats deleteTable = new GlueMetastoreApiStats(); + private final GlueMetastoreApiStats updateTable = new GlueMetastoreApiStats(); private final GlueMetastoreApiStats getPartitionNames = new GlueMetastoreApiStats(); private final GlueMetastoreApiStats getPartitions = new GlueMetastoreApiStats(); private final GlueMetastoreApiStats getPartition = new GlueMetastoreApiStats(); private final GlueMetastoreApiStats getPartitionByName = new GlueMetastoreApiStats(); - private final GlueMetastoreApiStats addPartitions = new GlueMetastoreApiStats(); - private final GlueMetastoreApiStats dropPartition = new GlueMetastoreApiStats(); - private final GlueMetastoreApiStats alterPartition = new GlueMetastoreApiStats(); + private final GlueMetastoreApiStats createPartitions = new GlueMetastoreApiStats(); + private final GlueMetastoreApiStats deletePartition = new GlueMetastoreApiStats(); + private final GlueMetastoreApiStats updatePartition = new GlueMetastoreApiStats(); private final GlueMetastoreApiStats getColumnStatisticsForTable = new GlueMetastoreApiStats(); private final GlueMetastoreApiStats getColumnStatisticsForPartition = new GlueMetastoreApiStats(); private final GlueMetastoreApiStats updateColumnStatisticsForTable = new GlueMetastoreApiStats(); @@ -65,9 +65,9 @@ public class GlueMetastoreStats @Managed @Nested - public GlueMetastoreApiStats getGetAllDatabases() + public GlueMetastoreApiStats getGetDatabases() { - return getAllDatabases; + return getDatabases; } @Managed @@ -79,9 +79,9 @@ public GlueMetastoreApiStats getGetDatabase() @Managed @Nested - public GlueMetastoreApiStats getGetAllTables() + public GlueMetastoreApiStats getGetTables() { - return getAllTables; + return getTables; } @Managed @@ -107,16 +107,16 @@ public GlueMetastoreApiStats getCreateDatabase() @Managed @Nested - public GlueMetastoreApiStats getDropDatabase() + public GlueMetastoreApiStats getDeleteDatabase() { - return dropDatabase; + return deleteDatabase; } @Managed @Nested - public GlueMetastoreApiStats getRenameDatabase() + public GlueMetastoreApiStats getUpdateDatabase() { - return renameDatabase; + return updateDatabase; } @Managed @@ -128,16 +128,16 @@ public GlueMetastoreApiStats getCreateTable() @Managed @Nested - public GlueMetastoreApiStats getDropTable() + public GlueMetastoreApiStats getDeleteTable() { - return dropTable; + return deleteTable; } @Managed @Nested - public GlueMetastoreApiStats getReplaceTable() + public GlueMetastoreApiStats getUpdateTable() { - return replaceTable; + return updateTable; } @Managed @@ -170,23 +170,23 @@ public GlueMetastoreApiStats getGetPartitionByName() @Managed @Nested - public GlueMetastoreApiStats getAddPartitions() + public GlueMetastoreApiStats getCreatePartitions() { - return addPartitions; + return createPartitions; } @Managed @Nested - public GlueMetastoreApiStats getDropPartition() + public GlueMetastoreApiStats getDeletePartition() { - return dropPartition; + return deletePartition; } @Managed @Nested - public GlueMetastoreApiStats getAlterPartition() + public GlueMetastoreApiStats getUpdatePartition() { - return alterPartition; + return updatePartition; } @Managed diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/metastore/glue/TestHiveGlueMetastore.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/metastore/glue/TestHiveGlueMetastore.java index 7d2efe2e6e06..70cec81984a5 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/metastore/glue/TestHiveGlueMetastore.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/metastore/glue/TestHiveGlueMetastore.java @@ -303,12 +303,12 @@ public void testGetDatabasesLogsStats() { GlueHiveMetastore metastore = (GlueHiveMetastore) getMetastoreClient(); GlueMetastoreStats stats = metastore.getStats(); - double initialCallCount = stats.getGetAllDatabases().getTime().getAllTime().getCount(); - long initialFailureCount = stats.getGetAllDatabases().getTotalFailures().getTotalCount(); + double initialCallCount = stats.getGetDatabases().getTime().getAllTime().getCount(); + long initialFailureCount = stats.getGetDatabases().getTotalFailures().getTotalCount(); getMetastoreClient().getAllDatabases(); - assertEquals(stats.getGetAllDatabases().getTime().getAllTime().getCount(), initialCallCount + 1.0); - assertTrue(stats.getGetAllDatabases().getTime().getAllTime().getAvg() > 0.0); - assertEquals(stats.getGetAllDatabases().getTotalFailures().getTotalCount(), initialFailureCount); + assertEquals(stats.getGetDatabases().getTime().getAllTime().getCount(), initialCallCount + 1.0); + assertTrue(stats.getGetDatabases().getTime().getAllTime().getAvg() > 0.0); + assertEquals(stats.getGetDatabases().getTotalFailures().getTotalCount(), initialFailureCount); } @Test