use of com.netflix.metacat.connector.hive.IMetacatHiveClient 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