use of io.trino.plugin.hive.metastore.thrift.BridgingHiveMetastore in project trino by trinodb.
the class AbstractTestHive method setup.
protected final void setup(String host, int port, String databaseName, String timeZone) {
HiveConfig hiveConfig = getHiveConfig().setParquetTimeZone(timeZone).setRcfileTimeZone(timeZone);
Optional<HostAndPort> proxy = Optional.ofNullable(System.getProperty("hive.metastore.thrift.client.socks-proxy")).map(HostAndPort::fromString);
MetastoreLocator metastoreLocator = new TestingMetastoreLocator(proxy, HostAndPort.fromParts(host, port));
hdfsEnvironment = new HdfsEnvironment(createTestHdfsConfiguration(), new HdfsConfig(), new NoHdfsAuthentication());
HiveMetastore metastore = cachingHiveMetastore(new BridgingHiveMetastore(new ThriftHiveMetastore(metastoreLocator, hiveConfig, new MetastoreConfig(), new ThriftMetastoreConfig(), hdfsEnvironment, false), new HiveIdentity(SESSION.getIdentity())), executor, new Duration(1, MINUTES), Optional.of(new Duration(15, SECONDS)), 10000);
setup(databaseName, hiveConfig, metastore, hdfsEnvironment);
}
use of io.trino.plugin.hive.metastore.thrift.BridgingHiveMetastore in project trino by trinodb.
the class BaseTestHiveOnDataLake method createQueryRunner.
@Override
protected QueryRunner createQueryRunner() throws Exception {
this.bucketName = "test-hive-insert-overwrite-" + randomTableSuffix();
this.dockerizedS3DataLake = closeAfterClass(new HiveMinioDataLake(bucketName, ImmutableMap.of(), hiveHadoopImage));
this.dockerizedS3DataLake.start();
this.metastoreClient = new BridgingHiveMetastore(new ThriftHiveMetastore(new TestingMetastoreLocator(Optional.empty(), this.dockerizedS3DataLake.getHiveHadoop().getHiveMetastoreEndpoint()), new HiveConfig(), new MetastoreConfig(), new ThriftMetastoreConfig(), new HdfsEnvironment(new HiveHdfsConfiguration(new HdfsConfigurationInitializer(new HdfsConfig(), ImmutableSet.of()), ImmutableSet.of()), new HdfsConfig(), new NoHdfsAuthentication()), false), HiveIdentity.none());
return S3HiveQueryRunner.create(dockerizedS3DataLake, ImmutableMap.<String, String>builder().put("hive.insert-existing-partitions-behavior", "OVERWRITE").put("hive.non-managed-table-writes-enabled", "true").put("hive.metastore-cache-ttl", "1d").put("hive.metastore-refresh-interval", "1d").buildOrThrow());
}
use of io.trino.plugin.hive.metastore.thrift.BridgingHiveMetastore in project trino by trinodb.
the class TestCachingHiveMetastore method setUp.
@BeforeMethod
public void setUp() {
mockClient = new MockThriftMetastoreClient();
ThriftHiveMetastore thriftHiveMetastore = createThriftHiveMetastore();
executor = listeningDecorator(newCachedThreadPool(daemonThreadsNamed(getClass().getSimpleName() + "-%s")));
metastore = cachingHiveMetastore(new BridgingHiveMetastore(thriftHiveMetastore, IDENTITY), executor, new Duration(5, TimeUnit.MINUTES), Optional.of(new Duration(1, TimeUnit.MINUTES)), 1000);
stats = thriftHiveMetastore.getStats();
}
use of io.trino.plugin.hive.metastore.thrift.BridgingHiveMetastore in project trino by trinodb.
the class TestCachingHiveMetastore method testCachingHiveMetastoreCreationViaMemoize.
@Test
public void testCachingHiveMetastoreCreationViaMemoize() {
ThriftHiveMetastore thriftHiveMetastore = createThriftHiveMetastore();
metastore = memoizeMetastore(new BridgingHiveMetastore(thriftHiveMetastore, IDENTITY), 1000);
assertEquals(mockClient.getAccessCount(), 0);
assertEquals(metastore.getAllDatabases(), ImmutableList.of(TEST_DATABASE));
assertEquals(mockClient.getAccessCount(), 1);
assertEquals(metastore.getAllDatabases(), ImmutableList.of(TEST_DATABASE));
assertEquals(mockClient.getAccessCount(), 1);
assertEquals(metastore.getDatabaseNamesStats().getRequestCount(), 0);
}
use of io.trino.plugin.hive.metastore.thrift.BridgingHiveMetastore in project trino by trinodb.
the class TestHiveInMemoryMetastore method createMetastore.
@Override
protected HiveMetastore createMetastore(File tempDir, HiveIdentity identity) {
File baseDir = new File(tempDir, "metastore");
ThriftMetastoreConfig metastoreConfig = new ThriftMetastoreConfig();
InMemoryThriftMetastore hiveMetastore = new InMemoryThriftMetastore(baseDir, metastoreConfig);
return new BridgingHiveMetastore(hiveMetastore, identity);
}
Aggregations