use of com.netflix.metacat.connector.hive.client.thrift.HiveMetastoreClientFactory in project metacat by Netflix.
the class HiveConnectorFactory method createThriftClient.
private IMetacatHiveClient createThriftClient() throws MetaException {
final HiveMetastoreClientFactory factory = new HiveMetastoreClientFactory(null, (int) HiveConnectorUtil.toTime(configuration.getOrDefault(HiveConfigConstants.HIVE_METASTORE_TIMEOUT, "20s"), TimeUnit.SECONDS, TimeUnit.MILLISECONDS));
final String metastoreUri = configuration.get(HiveConfigConstants.THRIFT_URI);
URI uri = null;
try {
uri = new URI(metastoreUri);
} catch (Exception e) {
final String message = String.format("Invalid thrift uri %s", metastoreUri);
log.info(message);
throw new IllegalArgumentException(message, e);
}
return new MetacatHiveClient(uri, factory);
}
use of com.netflix.metacat.connector.hive.client.thrift.HiveMetastoreClientFactory in project metacat by Netflix.
the class HiveConnectorConfig method createThriftClient.
/**
* create thrift hive client.
*
* @param connectorContext connector config.
* @return data source
* @throws MetaException meta exception
*/
@Bean
@ConditionalOnMissingBean(IMetacatHiveClient.class)
public IMetacatHiveClient createThriftClient(final ConnectorContext connectorContext) throws MetaException {
final HiveMetastoreClientFactory factory = new HiveMetastoreClientFactory(null, (int) TimeUtil.toTime(connectorContext.getConfiguration().getOrDefault(HiveConfigConstants.HIVE_METASTORE_TIMEOUT, "20s"), TimeUnit.SECONDS, TimeUnit.MILLISECONDS));
final String metastoreUri = connectorContext.getConfiguration().get(HiveConfigConstants.THRIFT_URI);
try {
return new MetacatHiveClient(new URI(metastoreUri), factory);
} catch (Exception e) {
final String message = String.format("Invalid thrift uri %s", metastoreUri);
log.info(message);
throw new IllegalArgumentException(message, e);
}
}
Aggregations