use of org.apache.hadoop.hive.metastore.HiveMetaStoreClient in project hive by apache.
the class SmokeTest method main.
public static void main(String[] args) throws Exception {
SmokeTest test = new SmokeTest();
conf = MetastoreConf.newMetastoreConf();
IMetaStoreClient client = new HiveMetaStoreClient(conf);
test.runTest(client);
}
use of org.apache.hadoop.hive.metastore.HiveMetaStoreClient in project SQLWindowing by hbutani.
the class HiveUtils method getTable.
public static Table getTable(String db, String tableName, Configuration conf) throws WindowingException {
HiveMetaStoreClient client = getClient(conf);
db = validateDB(client, db);
return getTable(client, db, tableName);
}
use of org.apache.hadoop.hive.metastore.HiveMetaStoreClient in project SQLWindowing by hbutani.
the class HiveUtils method addTableasJobInput.
@SuppressWarnings("unchecked")
public static List<FieldSchema> addTableasJobInput(String db, String table, JobConf job, FileSystem fs) throws WindowingException {
LOG.info("HiveUtils::addTableasJobInput invoked");
try {
HiveMetaStoreClient client = getClient(job);
// 1. get Table details from Hive metastore
db = validateDB(client, db);
Table t = getTable(client, db, table);
StorageDescriptor sd = t.getSd();
// 2. add table's location to job input
FileInputFormat.addInputPath(job, new Path(sd.getLocation()));
// 3. set job inputFormatClass, extract from StorageDescriptor
Class<? extends InputFormat<? extends Writable, ? extends Writable>> inputFormatClass = (Class<? extends InputFormat<? extends Writable, ? extends Writable>>) Class.forName(sd.getInputFormat());
job.setInputFormat(inputFormatClass);
return client.getFields(db, table);
} catch (WindowingException w) {
throw w;
} catch (Exception e) {
throw new WindowingException(e);
}
}
use of org.apache.hadoop.hive.metastore.HiveMetaStoreClient in project SQLWindowing by hbutani.
the class HiveUtils method getFields.
public static List<FieldSchema> getFields(String db, String table, JobConf job) throws WindowingException {
LOG.info("HiveUtils::getFields invoked");
try {
HiveMetaStoreClient client = getClient(job);
db = validateDB(client, db);
getTable(client, db, table);
return client.getFields(db, table);
} catch (WindowingException w) {
throw w;
} catch (Exception e) {
throw new WindowingException(e);
}
}
use of org.apache.hadoop.hive.metastore.HiveMetaStoreClient in project SQLWindowing by hbutani.
the class HiveUtils method getDeserializer.
public static Deserializer getDeserializer(String db, String table, Configuration conf) throws WindowingException {
LOG.info("HiveUtils::getDeserializer invoked");
try {
HiveMetaStoreClient client = getClient(conf);
db = validateDB(client, db);
Table t = getTable(client, db, table);
return MetaStoreUtils.getDeserializer(conf, t);
} catch (WindowingException w) {
throw w;
} catch (Exception e) {
throw new WindowingException(e);
}
}
Aggregations