org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore Java Examples

The following examples show how to use org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestLoggingInvocationHandlerWithHiveMetastore.java    From presto with Apache License 2.0 6 votes vote down vote up
@Test
public void testWithThriftHiveMetastoreClient()
        throws Exception
{
    List<String> messages = new ArrayList<>();
    // LoggingInvocationHandler is used e.g. with ThriftHiveMetastore.Iface. Since the logging is reflection-based,
    // we test it with this interface as well.
    ThriftHiveMetastore.Iface proxy = newProxy(ThriftHiveMetastore.Iface.class, new LoggingInvocationHandler(
            dummyThriftHiveMetastoreClient(),
            new AirliftParameterNamesProvider(ThriftHiveMetastore.Iface.class, ThriftHiveMetastore.Client.class),
            messages::add));
    proxy.get_table("some_database", "some_table_name");
    assertThat(messages)
            .hasSize(1)
            .element(0).matches(message -> message.matches("\\QInvocation of get_table(dbname='some_database', tbl_name='some_table_name') succeeded in\\E " + DURATION_PATTERN));
}
 
Example #2
Source File: ThriftHiveMetastoreClient.java    From presto with Apache License 2.0 5 votes vote down vote up
public ThriftHiveMetastoreClient(TTransport transport, String hostname)
{
    this.transport = requireNonNull(transport, "transport is null");
    ThriftHiveMetastore.Client client = new ThriftHiveMetastore.Client(new TBinaryProtocol(transport));
    if (log.isDebugEnabled()) {
        this.client = newProxy(ThriftHiveMetastore.Iface.class, new LoggingInvocationHandler(client, PARAMETER_NAMES_PROVIDER, log::debug));
    }
    else {
        this.client = client;
    }
    this.hostname = requireNonNull(hostname, "hostname is null");
}
 
Example #3
Source File: TestLoggingInvocationHandlerWithHiveMetastore.java    From presto with Apache License 2.0 5 votes vote down vote up
private static ThriftHiveMetastore.Iface dummyThriftHiveMetastoreClient()
{
    return (ThriftHiveMetastore.Iface) newProxyInstance(
            TestLoggingInvocationHandlerWithHiveMetastore.class.getClassLoader(),
            new Class<?>[] {ThriftHiveMetastore.Iface.class},
            (proxy, method, args) -> null);
}
 
Example #4
Source File: HiveTables.java    From iceberg with Apache License 2.0 5 votes vote down vote up
private ThriftHiveMetastore.Client getClient() {
  final URI metastoreUri = URI.create(MetastoreConf.getAsString(conf, THRIFT_URIS));
  final int socketTimeOut = (int) MetastoreConf.getTimeVar(conf, CLIENT_SOCKET_TIMEOUT, TimeUnit.MILLISECONDS);
  TTransport transport = new TSocket(metastoreUri.getHost(), metastoreUri.getPort(), socketTimeOut);
  try {
    transport.open();
  } catch (TTransportException e) {
    throw new RuntimeException("failed to open socket for " + metastoreUri + " with timeoutMillis " + socketTimeOut);
  }
  return new ThriftHiveMetastore.Client(new TBinaryProtocol(transport));
}
 
Example #5
Source File: HiveCompatibleThriftHiveMetastoreIfaceFactory.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
private CloseableThriftHiveMetastoreIface newInstance(
    ThriftHiveMetastore.Client delegate,
    HiveThriftMetaStoreIfaceCompatibility compatibility) {
  ClassLoader classLoader = CloseableThriftHiveMetastoreIface.class.getClassLoader();
  Class<?>[] interfaces = new Class<?>[] { CloseableThriftHiveMetastoreIface.class };
  ThriftMetaStoreClientInvocationHandler handler = new ThriftMetaStoreClientInvocationHandler(delegate,
      compatibility);
  return (CloseableThriftHiveMetastoreIface) Proxy.newProxyInstance(classLoader, interfaces, handler);
}
 
Example #6
Source File: CatalogThriftService.java    From metacat with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public TProcessor getProcessor() {
    return new ThriftHiveMetastore.Processor<>(
        new CatalogThriftHiveMetastore(config, hiveConverters, metacatV1, partitionV1, catalogName, registry)
    );
}
 
Example #7
Source File: HiveTableOperations.java    From iceberg with Apache License 2.0 4 votes vote down vote up
protected HiveTableOperations(Configuration conf, ThriftHiveMetastore.Client metaStoreClient, String database, String table) {
  super(conf);
  this.metaStoreClient = metaStoreClient;
  this.database = database;
  this.tableName = table;
}
 
Example #8
Source File: IdentityMapping.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
@Override
public ThriftHiveMetastore.Iface getClient() {
  return metaStoreMapping.getClient();
}
 
Example #9
Source File: MetaStoreMappingImpl.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
@Override
public ThriftHiveMetastore.Iface getClient() {
  return client;
}
 
Example #10
Source File: ThriftMetastoreClientManager.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
protected ThriftHiveMetastore.Iface getClient() {
  return client;
}
 
Example #11
Source File: HiveCompatibleThriftHiveMetastoreIfaceFactory.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
ThriftMetaStoreClientInvocationHandler(
    ThriftHiveMetastore.Client delegate,
    HiveThriftMetaStoreIfaceCompatibility compatibility) {
  this.delegate = delegate;
  this.compatibility = compatibility;
}
 
Example #12
Source File: HiveCompatibleThriftHiveMetastoreIfaceFactory.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
public CloseableThriftHiveMetastoreIface newInstance(ThriftHiveMetastore.Client delegate) {
  HiveThriftMetaStoreIfaceCompatibility compatibility = new HiveThriftMetaStoreIfaceCompatibility1xx(delegate);
  return newInstance(delegate, compatibility);
}
 
Example #13
Source File: HiveThriftMetaStoreIfaceCompatibility1xx.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
public HiveThriftMetaStoreIfaceCompatibility1xx(ThriftHiveMetastore.Client client) {
  this.client = client;
}
 
Example #14
Source File: FederatedHMSHandler.java    From waggle-dance with Apache License 2.0 4 votes vote down vote up
private ThriftHiveMetastore.Iface getPrimaryClient() throws TException {
  return databaseMappingService.primaryDatabaseMapping().getClient();
}
 
Example #15
Source File: HiveClientExposer.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
public static ThriftHiveMetastore.Iface getClient(HiveMetaStoreClient client){
  return client.client;
}
 
Example #16
Source File: MetaStoreMapping.java    From waggle-dance with Apache License 2.0 votes vote down vote up
ThriftHiveMetastore.Iface getClient();