org.apache.hadoop.hive.metastore.RetryingMetaStoreClient Java Examples

The following examples show how to use org.apache.hadoop.hive.metastore.RetryingMetaStoreClient. 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: HiveMetaStoreClientFactory.java    From incubator-gobblin with Apache License 2.0 7 votes vote down vote up
private IMetaStoreClient createMetaStoreClient() throws MetaException {
  HiveMetaHookLoader hookLoader = new HiveMetaHookLoader() {
    @Override
    public HiveMetaHook getHook(Table tbl) throws MetaException {
      if (tbl == null) {
        return null;
      }

      try {
        HiveStorageHandler storageHandler =
            HiveUtils.getStorageHandler(hiveConf, tbl.getParameters().get(META_TABLE_STORAGE));
        return storageHandler == null ? null : storageHandler.getMetaHook();
      } catch (HiveException e) {
        LOG.error(e.toString());
        throw new MetaException("Failed to get storage handler: " + e);
      }
    }
  };

  return RetryingMetaStoreClient.getProxy(hiveConf, hookLoader, HiveMetaStoreClient.class.getName());
}
 
Example #2
Source File: HiveShimV1.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public IMetaStoreClient getHiveMetastoreClient(HiveConf hiveConf) {
	try {
		Method method = RetryingMetaStoreClient.class.getMethod("getProxy", HiveConf.class);
		// getProxy is a static method
		return (IMetaStoreClient) method.invoke(null, (hiveConf));
	} catch (Exception ex) {
		throw new CatalogException("Failed to create Hive Metastore client", ex);
	}
}
 
Example #3
Source File: HiveShimV2.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public IMetaStoreClient getHiveMetastoreClient(HiveConf hiveConf) {
	try {
		Method method = RetryingMetaStoreClient.class.getMethod("getProxy", HiveConf.class, Boolean.TYPE);
		// getProxy is a static method
		return (IMetaStoreClient) method.invoke(null, hiveConf, true);
	} catch (Exception ex) {
		throw new CatalogException("Failed to create Hive Metastore client", ex);
	}
}
 
Example #4
Source File: HiveShimV120.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public IMetaStoreClient getHiveMetastoreClient(HiveConf hiveConf) {
	try {
		Method method = RetryingMetaStoreClient.class.getMethod("getProxy", HiveConf.class);
		// getProxy is a static method
		return (IMetaStoreClient) method.invoke(null, (hiveConf));
	} catch (Exception ex) {
		throw new CatalogException("Failed to create Hive Metastore client", ex);
	}
}
 
Example #5
Source File: HiveShimV230.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public IMetaStoreClient getHiveMetastoreClient(HiveConf hiveConf) {
	try {
		Method method = RetryingMetaStoreClient.class.getMethod("getProxy", HiveConf.class, Boolean.TYPE);
		// getProxy is a static method
		return (IMetaStoreClient) method.invoke(null, hiveConf, true);
	} catch (Exception ex) {
		throw new CatalogException("Failed to create Hive Metastore client", ex);
	}
}
 
Example #6
Source File: HiveShimV200.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public IMetaStoreClient getHiveMetastoreClient(HiveConf hiveConf) {
	try {
		Class<?>[] constructorArgTypes = {HiveConf.class};
		Object[] constructorArgs = {hiveConf};
		Method method = RetryingMetaStoreClient.class.getMethod("getProxy", HiveConf.class,
			constructorArgTypes.getClass(), constructorArgs.getClass(), String.class);
		// getProxy is a static method
		return (IMetaStoreClient) method.invoke(null, hiveConf, constructorArgTypes, constructorArgs,
			HiveMetaStoreClient.class.getName());
	} catch (Exception ex) {
		throw new CatalogException("Failed to create Hive Metastore client", ex);
	}
}
 
Example #7
Source File: HiveShimV310.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public IMetaStoreClient getHiveMetastoreClient(HiveConf hiveConf) {
	try {
		Method method = RetryingMetaStoreClient.class.getMethod("getProxy", Configuration.class, Boolean.TYPE);
		// getProxy is a static method
		return (IMetaStoreClient) method.invoke(null, hiveConf, true);
	} catch (Exception ex) {
		throw new CatalogException("Failed to create Hive Metastore client", ex);
	}
}
 
Example #8
Source File: MetaStoreClientFactory.java    From data-highway with Apache License 2.0 4 votes vote down vote up
private IMetaStoreClient retryingClient(HiveConf conf) throws MetaException {
  return RetryingMetaStoreClient.getProxy(conf, tbl -> null, HiveMetaStoreClient.class.getName());
}
 
Example #9
Source File: HiveClientWrapper.java    From pxf with Apache License 2.0 4 votes vote down vote up
IMetaStoreClient initHiveClient(HiveConf hiveConf) throws MetaException {
    return RetryingMetaStoreClient.getProxy(hiveConf, new Class[]{HiveConf.class, HiveMetaHookLoader.class, Boolean.class},
            new Object[]{hiveConf, null, true}, null, HiveMetaStoreClientCompatibility1xx.class.getName()
    );
}