diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/IcebergTestUtils.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/IcebergTestUtils.java index 0314fd6c095d..9d70f271f4a2 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/IcebergTestUtils.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/IcebergTestUtils.java @@ -33,6 +33,7 @@ import io.trino.parquet.reader.MetadataReader; import io.trino.plugin.base.metrics.FileFormatDataSourceStats; import io.trino.plugin.hive.TrinoViewHiveMetastore; +import io.trino.plugin.hive.metastore.HiveMetastoreFactory; import io.trino.plugin.hive.metastore.cache.CachingHiveMetastore; import io.trino.plugin.hive.parquet.TrinoParquetDataSource; import io.trino.plugin.iceberg.catalog.IcebergTableOperationsProvider; @@ -160,6 +161,13 @@ public static TrinoFileSystemFactory getFileSystemFactory(QueryRunner queryRunne .getInjector().getInstance(TrinoFileSystemFactory.class); } + public static HiveMetastore getHiveMetastore(QueryRunner queryRunner) + { + return ((IcebergConnector) queryRunner.getCoordinator().getConnector(ICEBERG_CATALOG)).getInjector() + .getInstance(HiveMetastoreFactory.class) + .createMetastore(Optional.empty()); + } + public static BaseTable loadTable(String tableName, HiveMetastore metastore, TrinoFileSystemFactory fileSystemFactory, diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergConnectorSmokeTest.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergConnectorSmokeTest.java index 04bac99f465f..b4b8dbfbd57e 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergConnectorSmokeTest.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergConnectorSmokeTest.java @@ -16,7 +16,6 @@ import com.google.common.collect.ImmutableMap; import io.trino.filesystem.Location; import io.trino.metastore.HiveMetastore; -import io.trino.plugin.hive.metastore.HiveMetastoreFactory; import io.trino.testing.QueryRunner; import io.trino.testing.sql.TestTable; import org.junit.jupiter.api.Test; @@ -24,10 +23,9 @@ import java.io.IOException; import java.io.UncheckedIOException; -import java.util.Optional; -import static io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG; import static io.trino.plugin.iceberg.IcebergTestUtils.checkOrcFileSorting; +import static io.trino.plugin.iceberg.IcebergTestUtils.getHiveMetastore; import static io.trino.tpch.TpchTable.NATION; import static io.trino.tpch.TpchTable.ORDERS; import static io.trino.tpch.TpchTable.REGION; @@ -59,9 +57,7 @@ protected QueryRunner createQueryRunner() "iceberg.register-table-procedure.enabled", "true", "iceberg.writer-sort-buffer-size", "1MB")) .build(); - metastore = ((IcebergConnector) queryRunner.getCoordinator().getConnector(ICEBERG_CATALOG)).getInjector() - .getInstance(HiveMetastoreFactory.class) - .createMetastore(Optional.empty()); + metastore = getHiveMetastore(queryRunner); return queryRunner; } diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergFileOperations.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergFileOperations.java index d3c5d273655a..bd914d4e0ae7 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergFileOperations.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergFileOperations.java @@ -21,7 +21,6 @@ import io.trino.SystemSessionProperties; import io.trino.filesystem.TrinoFileSystemFactory; import io.trino.metastore.HiveMetastore; -import io.trino.plugin.hive.metastore.HiveMetastoreFactory; import io.trino.plugin.iceberg.util.FileOperationUtils; import io.trino.plugin.tpch.TpchPlugin; import io.trino.testing.AbstractTestQueryFramework; @@ -45,6 +44,7 @@ import static io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG; import static io.trino.plugin.iceberg.IcebergSessionProperties.COLLECT_EXTENDED_STATISTICS_ON_WRITE; import static io.trino.plugin.iceberg.IcebergTestUtils.getFileSystemFactory; +import static io.trino.plugin.iceberg.IcebergTestUtils.getHiveMetastore; import static io.trino.plugin.iceberg.util.EqualityDeleteUtils.writeEqualityDeleteForTable; import static io.trino.plugin.iceberg.util.FileOperationUtils.FileOperation; import static io.trino.plugin.iceberg.util.FileOperationUtils.FileType.DATA; @@ -100,9 +100,7 @@ protected QueryRunner createQueryRunner() .put("iceberg.metadata-cache.enabled", "false") .buildOrThrow()); - metastore = ((IcebergConnector) queryRunner.getCoordinator().getConnector(ICEBERG_CATALOG)).getInjector() - .getInstance(HiveMetastoreFactory.class) - .createMetastore(Optional.empty()); + metastore = getHiveMetastore(queryRunner); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergGetTableStatisticsOperations.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergGetTableStatisticsOperations.java index 82156f5496cf..d7be5d85dc59 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergGetTableStatisticsOperations.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergGetTableStatisticsOperations.java @@ -17,7 +17,6 @@ import io.opentelemetry.sdk.trace.data.SpanData; import io.trino.metastore.Database; import io.trino.metastore.HiveMetastore; -import io.trino.plugin.hive.metastore.HiveMetastoreFactory; import io.trino.plugin.tpch.TpchPlugin; import io.trino.spi.security.PrincipalType; import io.trino.testing.AbstractTestQueryFramework; @@ -32,7 +31,7 @@ import java.nio.file.Path; import java.util.Optional; -import static io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG; +import static io.trino.plugin.iceberg.IcebergTestUtils.getHiveMetastore; import static io.trino.testing.TestingSession.testSession; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; @@ -62,9 +61,7 @@ protected QueryRunner createQueryRunner() queryRunner.installPlugin(new TestingIcebergPlugin(metastoreDir)); queryRunner.createCatalog("iceberg", "iceberg", ImmutableMap.of()); - HiveMetastore metastore = ((IcebergConnector) queryRunner.getCoordinator().getConnector(ICEBERG_CATALOG)).getInjector() - .getInstance(HiveMetastoreFactory.class) - .createMetastore(Optional.empty()); + HiveMetastore metastore = getHiveMetastore(queryRunner); Database database = Database.builder() .setDatabaseName("tiny") diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMaterializedView.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMaterializedView.java index cdbef51ac2e7..b7cb33d278ac 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMaterializedView.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMaterializedView.java @@ -16,16 +16,14 @@ import io.trino.Session; import io.trino.metastore.HiveMetastore; import io.trino.metastore.Table; -import io.trino.plugin.hive.metastore.HiveMetastoreFactory; import io.trino.sql.tree.ExplainType; import io.trino.testing.QueryRunner; import org.junit.jupiter.api.Test; import java.util.Map; -import java.util.Optional; import static io.trino.plugin.base.util.Closables.closeAllSuppress; -import static io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG; +import static io.trino.plugin.iceberg.IcebergTestUtils.getHiveMetastore; import static org.apache.iceberg.BaseMetastoreTableOperations.METADATA_LOCATION_PROP; import static org.assertj.core.api.Assertions.assertThat; @@ -42,9 +40,7 @@ protected QueryRunner createQueryRunner() QueryRunner queryRunner = IcebergQueryRunner.builder() .build(); try { - metastore = ((IcebergConnector) queryRunner.getCoordinator().getConnector(ICEBERG_CATALOG)).getInjector() - .getInstance(HiveMetastoreFactory.class) - .createMetastore(Optional.empty()); + metastore = getHiveMetastore(queryRunner); queryRunner.createCatalog("iceberg2", "iceberg", Map.of( "iceberg.catalog.type", "TESTING_FILE_METASTORE", diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMergeAppend.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMergeAppend.java index 5057a7d7652e..cce80e901972 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMergeAppend.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMergeAppend.java @@ -16,7 +16,6 @@ import io.trino.filesystem.TrinoFileSystemFactory; import io.trino.metastore.HiveMetastore; import io.trino.plugin.hive.TrinoViewHiveMetastore; -import io.trino.plugin.hive.metastore.HiveMetastoreFactory; import io.trino.plugin.hive.metastore.cache.CachingHiveMetastore; import io.trino.plugin.iceberg.catalog.IcebergTableOperationsProvider; import io.trino.plugin.iceberg.catalog.TrinoCatalog; @@ -32,12 +31,10 @@ import org.apache.iceberg.Table; import org.junit.jupiter.api.Test; -import java.util.Optional; - import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static io.trino.plugin.hive.metastore.cache.CachingHiveMetastore.createPerTransactionCache; -import static io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG; import static io.trino.plugin.iceberg.IcebergTestUtils.getFileSystemFactory; +import static io.trino.plugin.iceberg.IcebergTestUtils.getHiveMetastore; import static org.assertj.core.api.Assertions.assertThat; public class TestIcebergMergeAppend @@ -51,9 +48,7 @@ protected QueryRunner createQueryRunner() throws Exception { QueryRunner queryRunner = IcebergQueryRunner.builder().build(); - HiveMetastore metastore = ((IcebergConnector) queryRunner.getCoordinator().getConnector(ICEBERG_CATALOG)).getInjector() - .getInstance(HiveMetastoreFactory.class) - .createMetastore(Optional.empty()); + HiveMetastore metastore = getHiveMetastore(queryRunner); CachingHiveMetastore cachingHiveMetastore = createPerTransactionCache(metastore, 1000); TrinoFileSystemFactory fileSystemFactory = getFileSystemFactory(queryRunner); tableOperationsProvider = new FileMetastoreTableOperationsProvider(fileSystemFactory); diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergOrcMetricsCollection.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergOrcMetricsCollection.java index b819c152dc36..02efbf39d572 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergOrcMetricsCollection.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergOrcMetricsCollection.java @@ -18,7 +18,6 @@ import io.trino.filesystem.TrinoFileSystemFactory; import io.trino.metastore.HiveMetastore; import io.trino.plugin.hive.TrinoViewHiveMetastore; -import io.trino.plugin.hive.metastore.HiveMetastoreFactory; import io.trino.plugin.hive.metastore.cache.CachingHiveMetastore; import io.trino.plugin.iceberg.catalog.IcebergTableOperationsProvider; import io.trino.plugin.iceberg.catalog.TrinoCatalog; @@ -41,7 +40,6 @@ import java.io.File; import java.util.List; import java.util.Map; -import java.util.Optional; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static io.trino.SystemSessionProperties.INITIAL_SPLITS_PER_NODE; @@ -53,6 +51,7 @@ import static io.trino.plugin.iceberg.DataFileRecord.toDataFileRecord; import static io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG; import static io.trino.plugin.iceberg.IcebergTestUtils.getFileSystemFactory; +import static io.trino.plugin.iceberg.IcebergTestUtils.getHiveMetastore; import static io.trino.testing.TestingSession.testSessionBuilder; import static org.assertj.core.api.Assertions.assertThat; @@ -88,9 +87,7 @@ protected QueryRunner createQueryRunner() TrinoFileSystemFactory fileSystemFactory = getFileSystemFactory(queryRunner); tableOperationsProvider = new FileMetastoreTableOperationsProvider(fileSystemFactory); - HiveMetastore metastore = ((IcebergConnector) queryRunner.getCoordinator().getConnector(ICEBERG_CATALOG)).getInjector() - .getInstance(HiveMetastoreFactory.class) - .createMetastore(Optional.empty()); + HiveMetastore metastore = getHiveMetastore(queryRunner); CachingHiveMetastore cachingHiveMetastore = createPerTransactionCache(metastore, 1000); trinoCatalog = new TrinoHiveCatalog( diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergSplitSource.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergSplitSource.java index 7c0ec949447a..62be3d6672c3 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergSplitSource.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergSplitSource.java @@ -21,7 +21,6 @@ import io.trino.filesystem.cache.DefaultCachingHostAddressProvider; import io.trino.metastore.HiveMetastore; import io.trino.plugin.hive.TrinoViewHiveMetastore; -import io.trino.plugin.hive.metastore.HiveMetastoreFactory; import io.trino.plugin.hive.metastore.cache.CachingHiveMetastore; import io.trino.plugin.hive.orc.OrcReaderConfig; import io.trino.plugin.hive.orc.OrcWriterConfig; @@ -86,9 +85,9 @@ import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService; import static io.trino.plugin.hive.metastore.cache.CachingHiveMetastore.createPerTransactionCache; -import static io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG; import static io.trino.plugin.iceberg.IcebergSplitSource.createFileStatisticsDomain; import static io.trino.plugin.iceberg.IcebergTestUtils.getFileSystemFactory; +import static io.trino.plugin.iceberg.IcebergTestUtils.getHiveMetastore; import static io.trino.plugin.iceberg.util.EqualityDeleteUtils.writeEqualityDeleteForTable; import static io.trino.spi.connector.Constraint.alwaysTrue; import static io.trino.spi.type.BigintType.BIGINT; @@ -127,9 +126,7 @@ protected QueryRunner createQueryRunner() .setMetastoreDirectory(metastoreDir) .build(); - HiveMetastore metastore = ((IcebergConnector) queryRunner.getCoordinator().getConnector(ICEBERG_CATALOG)).getInjector() - .getInstance(HiveMetastoreFactory.class) - .createMetastore(Optional.empty()); + HiveMetastore metastore = getHiveMetastore(queryRunner); this.fileSystemFactory = getFileSystemFactory(queryRunner); CachingHiveMetastore cachingHiveMetastore = createPerTransactionCache(metastore, 1000); diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergTableWithCustomLocation.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergTableWithCustomLocation.java index 5e28ce6999f1..36edac5015ea 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergTableWithCustomLocation.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergTableWithCustomLocation.java @@ -17,7 +17,6 @@ import io.trino.filesystem.TrinoFileSystem; import io.trino.metastore.HiveMetastore; import io.trino.metastore.Table; -import io.trino.plugin.hive.metastore.HiveMetastoreFactory; import io.trino.testing.AbstractTestQueryFramework; import io.trino.testing.MaterializedResult; import io.trino.testing.QueryRunner; @@ -30,8 +29,8 @@ import static io.trino.plugin.hive.TableType.EXTERNAL_TABLE; import static io.trino.plugin.iceberg.DataFileRecord.toDataFileRecord; -import static io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG; import static io.trino.plugin.iceberg.IcebergTestUtils.getFileSystemFactory; +import static io.trino.plugin.iceberg.IcebergTestUtils.getHiveMetastore; import static io.trino.testing.TestingConnectorSession.SESSION; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; @@ -50,9 +49,7 @@ protected QueryRunner createQueryRunner() .setIcebergProperties(Map.of("iceberg.unique-table-location", "true")) .build(); - metastore = ((IcebergConnector) queryRunner.getCoordinator().getConnector(ICEBERG_CATALOG)).getInjector() - .getInstance(HiveMetastoreFactory.class) - .createMetastore(Optional.empty()); + metastore = getHiveMetastore(queryRunner); return queryRunner; } diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergTableWithExternalLocation.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergTableWithExternalLocation.java index 33ed223cb8a8..c80c6b166b77 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergTableWithExternalLocation.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergTableWithExternalLocation.java @@ -17,7 +17,6 @@ import io.trino.filesystem.TrinoFileSystem; import io.trino.metastore.HiveMetastore; import io.trino.metastore.Table; -import io.trino.plugin.hive.metastore.HiveMetastoreFactory; import io.trino.testing.AbstractTestQueryFramework; import io.trino.testing.MaterializedResult; import io.trino.testing.QueryRunner; @@ -27,12 +26,11 @@ import java.io.File; import java.io.IOException; -import java.util.Optional; import static io.trino.plugin.hive.TableType.EXTERNAL_TABLE; import static io.trino.plugin.iceberg.DataFileRecord.toDataFileRecord; -import static io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG; import static io.trino.plugin.iceberg.IcebergTestUtils.getFileSystemFactory; +import static io.trino.plugin.iceberg.IcebergTestUtils.getHiveMetastore; import static io.trino.testing.TestingConnectorSession.SESSION; import static io.trino.testing.TestingNames.randomNameSuffix; import static java.lang.String.format; @@ -53,9 +51,7 @@ protected QueryRunner createQueryRunner() QueryRunner queryRunner = IcebergQueryRunner.builder() .build(); - metastore = ((IcebergConnector) queryRunner.getCoordinator().getConnector(ICEBERG_CATALOG)).getInjector() - .getInstance(HiveMetastoreFactory.class) - .createMetastore(Optional.empty()); + metastore = getHiveMetastore(queryRunner); return queryRunner; } diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergTableWithObjectStoreLayout.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergTableWithObjectStoreLayout.java index 3cea174502a8..912d88c13d05 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergTableWithObjectStoreLayout.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergTableWithObjectStoreLayout.java @@ -17,16 +17,13 @@ import io.trino.filesystem.TrinoFileSystem; import io.trino.metastore.HiveMetastore; import io.trino.metastore.Table; -import io.trino.plugin.hive.metastore.HiveMetastoreFactory; import io.trino.testing.AbstractTestQueryFramework; import io.trino.testing.DistributedQueryRunner; import org.junit.jupiter.api.Test; -import java.util.Optional; - import static io.trino.plugin.hive.TableType.EXTERNAL_TABLE; -import static io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG; import static io.trino.plugin.iceberg.IcebergTestUtils.getFileSystemFactory; +import static io.trino.plugin.iceberg.IcebergTestUtils.getHiveMetastore; import static io.trino.testing.TestingConnectorSession.SESSION; import static org.assertj.core.api.Assertions.assertThat; @@ -44,9 +41,7 @@ protected DistributedQueryRunner createQueryRunner() .addIcebergProperty("iceberg.object-store-layout.enabled", "true") .build(); - metastore = ((IcebergConnector) queryRunner.getCoordinator().getConnector(ICEBERG_CATALOG)).getInjector() - .getInstance(HiveMetastoreFactory.class) - .createMetastore(Optional.empty()); + metastore = getHiveMetastore(queryRunner); fileSystem = getFileSystemFactory(queryRunner).create(SESSION); diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergV2.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergV2.java index f41099ed50b1..67aa3ab38a62 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergV2.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergV2.java @@ -30,7 +30,6 @@ import io.trino.plugin.blackhole.BlackHolePlugin; import io.trino.plugin.hive.HiveStorageFormat; import io.trino.plugin.hive.TestingHivePlugin; -import io.trino.plugin.hive.metastore.HiveMetastoreFactory; import io.trino.plugin.iceberg.fileio.ForwardingFileIo; import io.trino.spi.predicate.Domain; import io.trino.spi.predicate.Range; @@ -95,8 +94,8 @@ import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.collect.ImmutableSet.toImmutableSet; import static com.google.common.collect.Iterables.getOnlyElement; -import static io.trino.plugin.iceberg.IcebergQueryRunner.ICEBERG_CATALOG; import static io.trino.plugin.iceberg.IcebergTestUtils.getFileSystemFactory; +import static io.trino.plugin.iceberg.IcebergTestUtils.getHiveMetastore; import static io.trino.plugin.iceberg.util.EqualityDeleteUtils.writeEqualityDeleteForTable; import static io.trino.plugin.iceberg.util.EqualityDeleteUtils.writeEqualityDeleteForTableWithSchema; import static io.trino.spi.type.BigintType.BIGINT; @@ -134,9 +133,7 @@ protected QueryRunner createQueryRunner() .setInitialTables(NATION) .build(); - metastore = ((IcebergConnector) queryRunner.getCoordinator().getConnector(ICEBERG_CATALOG)).getInjector() - .getInstance(HiveMetastoreFactory.class) - .createMetastore(Optional.empty()); + metastore = getHiveMetastore(queryRunner); queryRunner.installPlugin(new TestingHivePlugin(queryRunner.getCoordinator().getBaseDataDir().resolve("iceberg_data"))); queryRunner.createCatalog("hive", "hive", ImmutableMap.builder()