Skip to content

Commit 999a616

Browse files
committed
Create TestingFileHiveMetastore
1 parent 1113994 commit 999a616

File tree

38 files changed

+81
-59
lines changed

38 files changed

+81
-59
lines changed

plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeLegacyCreateTableWithExistingLocation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import static com.google.common.io.MoreFiles.deleteRecursively;
2929
import static com.google.common.io.RecursiveDeleteOption.ALLOW_INSECURE;
3030
import static io.trino.plugin.deltalake.DeltaLakeQueryRunner.createDeltaLakeQueryRunner;
31-
import static io.trino.plugin.hive.metastore.file.FileHiveMetastore.createTestingFileHiveMetastore;
31+
import static io.trino.plugin.hive.metastore.file.TestingFileHiveMetastore.createTestingFileHiveMetastore;
3232
import static io.trino.testing.TestingNames.randomNameSuffix;
3333
import static java.lang.String.format;
3434
import static org.assertj.core.api.Assertions.assertThat;

plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakePerTransactionMetastoreCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
import static io.trino.plugin.deltalake.DeltaLakeQueryRunner.DELTA_CATALOG;
4242
import static io.trino.plugin.hive.metastore.CountingAccessHiveMetastore.Method.GET_TABLE;
43-
import static io.trino.plugin.hive.metastore.file.FileHiveMetastore.createTestingFileHiveMetastore;
43+
import static io.trino.plugin.hive.metastore.file.TestingFileHiveMetastore.createTestingFileHiveMetastore;
4444
import static io.trino.testing.TestingNames.randomNameSuffix;
4545
import static io.trino.testing.TestingSession.testSessionBuilder;
4646
import static java.lang.String.format;

plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeRegisterTableProcedureWithFileMetastore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import java.nio.file.Path;
1919

20-
import static io.trino.plugin.hive.metastore.file.FileHiveMetastore.createTestingFileHiveMetastore;
20+
import static io.trino.plugin.hive.metastore.file.TestingFileHiveMetastore.createTestingFileHiveMetastore;
2121

2222
public class TestDeltaLakeRegisterTableProcedureWithFileMetastore
2323
extends BaseDeltaLakeRegisterTableProcedureTest

plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeSharedFileMetastoreViews.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import java.nio.file.Path;
1919

20-
import static io.trino.plugin.hive.metastore.file.FileHiveMetastore.createTestingFileHiveMetastore;
20+
import static io.trino.plugin.hive.metastore.file.TestingFileHiveMetastore.createTestingFileHiveMetastore;
2121

2222
public class TestDeltaLakeSharedFileMetastoreViews
2323
extends BaseDeltaLakeSharedMetastoreViewsTest

plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeTableWithCustomLocationUsingHiveMetastore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import java.util.Map;
2323

2424
import static io.trino.plugin.deltalake.DeltaLakeConnectorFactory.CONNECTOR_NAME;
25-
import static io.trino.plugin.hive.metastore.file.FileHiveMetastore.createTestingFileHiveMetastore;
25+
import static io.trino.plugin.hive.metastore.file.TestingFileHiveMetastore.createTestingFileHiveMetastore;
2626
import static io.trino.testing.TestingSession.testSessionBuilder;
2727

2828
public class TestDeltaLakeTableWithCustomLocationUsingHiveMetastore

plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/metastore/TestDeltaLakeMetastoreAccessOperations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import static io.trino.plugin.hive.metastore.CountingAccessHiveMetastore.Method.DROP_TABLE;
3939
import static io.trino.plugin.hive.metastore.CountingAccessHiveMetastore.Method.GET_DATABASE;
4040
import static io.trino.plugin.hive.metastore.CountingAccessHiveMetastore.Method.GET_TABLE;
41-
import static io.trino.plugin.hive.metastore.file.FileHiveMetastore.createTestingFileHiveMetastore;
41+
import static io.trino.plugin.hive.metastore.file.TestingFileHiveMetastore.createTestingFileHiveMetastore;
4242
import static io.trino.testing.TestingSession.testSessionBuilder;
4343
import static java.util.Objects.requireNonNull;
4444

plugin/trino-geospatial/src/test/java/io/trino/plugin/geospatial/TestSpatialJoins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import java.util.Optional;
2727

2828
import static io.trino.SystemSessionProperties.SPATIAL_PARTITIONING_TABLE_NAME;
29-
import static io.trino.plugin.hive.metastore.file.FileHiveMetastore.createTestingFileHiveMetastore;
29+
import static io.trino.plugin.hive.metastore.file.TestingFileHiveMetastore.createTestingFileHiveMetastore;
3030
import static io.trino.testing.TestingSession.testSessionBuilder;
3131
import static java.lang.String.format;
3232

plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/file/FileHiveMetastore.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
*/
1414
package io.trino.plugin.hive.metastore.file;
1515

16-
import com.google.common.annotations.VisibleForTesting;
1716
import com.google.common.cache.CacheLoader;
1817
import com.google.common.cache.LoadingCache;
1918
import com.google.common.collect.ImmutableList;
@@ -24,13 +23,8 @@
2423
import com.google.common.io.ByteStreams;
2524
import io.airlift.json.JsonCodec;
2625
import io.trino.collect.cache.EvictableCacheBuilder;
27-
import io.trino.hdfs.DynamicHdfsConfiguration;
28-
import io.trino.hdfs.HdfsConfig;
29-
import io.trino.hdfs.HdfsConfiguration;
30-
import io.trino.hdfs.HdfsConfigurationInitializer;
3126
import io.trino.hdfs.HdfsContext;
3227
import io.trino.hdfs.HdfsEnvironment;
33-
import io.trino.hdfs.authentication.NoHdfsAuthentication;
3428
import io.trino.plugin.hive.HiveBasicStatistics;
3529
import io.trino.plugin.hive.HiveColumnStatisticType;
3630
import io.trino.plugin.hive.HiveType;
@@ -45,7 +39,6 @@
4539
import io.trino.plugin.hive.metastore.Database;
4640
import io.trino.plugin.hive.metastore.HiveColumnStatistics;
4741
import io.trino.plugin.hive.metastore.HiveMetastore;
48-
import io.trino.plugin.hive.metastore.HiveMetastoreConfig;
4942
import io.trino.plugin.hive.metastore.HivePrincipal;
5043
import io.trino.plugin.hive.metastore.HivePrivilegeInfo;
5144
import io.trino.plugin.hive.metastore.HivePrivilegeInfo.HivePrivilege;
@@ -72,7 +65,6 @@
7265
import javax.annotation.concurrent.GuardedBy;
7366
import javax.annotation.concurrent.ThreadSafe;
7467

75-
import java.io.File;
7668
import java.io.IOException;
7769
import java.io.OutputStream;
7870
import java.util.ArrayDeque;
@@ -168,21 +160,6 @@ public class FileHiveMetastore
168160
// TODO Remove this speed-up workaround once that https://github.com/trinodb/trino/issues/13115 gets implemented
169161
private final LoadingCache<String, List<String>> listTablesCache;
170162

171-
@VisibleForTesting
172-
public static FileHiveMetastore createTestingFileHiveMetastore(File catalogDirectory)
173-
{
174-
HdfsConfig hdfsConfig = new HdfsConfig();
175-
HdfsConfiguration hdfsConfiguration = new DynamicHdfsConfiguration(new HdfsConfigurationInitializer(hdfsConfig), ImmutableSet.of());
176-
HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, hdfsConfig, new NoHdfsAuthentication());
177-
return new FileHiveMetastore(
178-
new NodeVersion("testversion"),
179-
hdfsEnvironment,
180-
new HiveMetastoreConfig().isHideDeltaLakeTables(),
181-
new FileHiveMetastoreConfig()
182-
.setCatalogDirectory(catalogDirectory.toURI().toString())
183-
.setMetastoreUser("test"));
184-
}
185-
186163
public FileHiveMetastore(NodeVersion nodeVersion, HdfsEnvironment hdfsEnvironment, boolean hideDeltaLakeTables, FileHiveMetastoreConfig config)
187164
{
188165
this.currentVersion = nodeVersion.toString();

plugin/trino-hive/src/test/java/io/trino/plugin/hive/HiveBenchmarkQueryRunner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
import static com.google.common.io.MoreFiles.deleteRecursively;
3232
import static com.google.common.io.RecursiveDeleteOption.ALLOW_INSECURE;
33-
import static io.trino.plugin.hive.metastore.file.FileHiveMetastore.createTestingFileHiveMetastore;
33+
import static io.trino.plugin.hive.metastore.file.TestingFileHiveMetastore.createTestingFileHiveMetastore;
3434
import static io.trino.testing.TestingSession.testSessionBuilder;
3535
import static java.util.Objects.requireNonNull;
3636

plugin/trino-hive/src/test/java/io/trino/plugin/hive/HiveQueryRunner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
import static com.google.inject.util.Modules.EMPTY_MODULE;
4949
import static io.airlift.log.Level.WARN;
5050
import static io.airlift.units.Duration.nanosSince;
51-
import static io.trino.plugin.hive.metastore.file.FileHiveMetastore.createTestingFileHiveMetastore;
51+
import static io.trino.plugin.hive.metastore.file.TestingFileHiveMetastore.createTestingFileHiveMetastore;
5252
import static io.trino.plugin.hive.security.HiveSecurityModule.ALLOW_ALL;
5353
import static io.trino.plugin.hive.security.HiveSecurityModule.SQL_STANDARD;
5454
import static io.trino.plugin.tpch.ColumnNaming.SIMPLIFIED;

0 commit comments

Comments
 (0)