use of org.apache.gobblin.hive.HiveMetastoreClientPool in project incubator-gobblin by apache.
the class HiveMaterializerSource method getHiveDataset.
private HiveDataset getHiveDataset(String tableString, FileSystem fs, State state) throws IOException {
try {
HiveMetastoreClientPool pool = HiveMetastoreClientPool.get(state.getProperties(), Optional.fromNullable(state.getProp(HIVE_METASTORE_URI_KEY)));
List<String> tokens = Splitter.on(".").splitToList(tableString);
DbAndTable sourceDbAndTable = new DbAndTable(tokens.get(0), tokens.get(1));
try (AutoReturnableObject<IMetaStoreClient> client = pool.getClient()) {
Table sourceTable = new Table(client.get().getTable(sourceDbAndTable.getDb(), sourceDbAndTable.getTable()));
return new HiveDataset(fs, pool, sourceTable, ConfigUtils.propertiesToConfig(state.getProperties()));
}
} catch (TException exc) {
throw new RuntimeException(exc);
}
}
Aggregations