本文整理匯總了Java中org.apache.hadoop.hive.conf.HiveConf.addResource方法的典型用法代碼示例。如果您正苦於以下問題:Java HiveConf.addResource方法的具體用法?Java HiveConf.addResource怎麽用?Java HiveConf.addResource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.hadoop.hive.conf.HiveConf
的用法示例。
在下文中一共展示了HiveConf.addResource方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: HiveMetaStore
import org.apache.hadoop.hive.conf.HiveConf; //導入方法依賴的package包/類
public HiveMetaStore(Configuration conf, HdfsSinkConnectorConfig connectorConfig) throws HiveMetaStoreException {
HiveConf hiveConf = new HiveConf(conf, HiveConf.class);
String hiveConfDir = connectorConfig.getString(HdfsSinkConnectorConfig.HIVE_CONF_DIR_CONFIG);
String hiveMetaStoreURIs = connectorConfig.getString(HdfsSinkConnectorConfig.HIVE_METASTORE_URIS_CONFIG);
if (hiveMetaStoreURIs.isEmpty()) {
log.warn("hive.metastore.uris empty, an embedded Hive metastore will be "
+ "created in the directory the connector is started. "
+ "You need to start Hive in that specific directory to query the data.");
}
if (!hiveConfDir.equals("")) {
String hiveSitePath = hiveConfDir + "/hive-site.xml";
File hiveSite = new File(hiveSitePath);
if (!hiveSite.exists()) {
log.warn("hive-site.xml does not exist in provided Hive configuration directory {}.", hiveConf);
}
hiveConf.addResource(new Path(hiveSitePath));
}
hiveConf.set("hive.metastore.uris", hiveMetaStoreURIs);
try {
client = HCatUtil.getHiveMetastoreClient(hiveConf);
} catch (IOException | MetaException e) {
throw new HiveMetaStoreException(e);
}
}
示例2: HiveExec
import org.apache.hadoop.hive.conf.HiveConf; //導入方法依賴的package包/類
/**
* HiveExec constructor
* @param config HDFS Connector configuration
*/
public HiveExec(HdfsSinkConnectorConfig config) {
hiveConf = new HiveConf();
String hiveConfDir = config.getString(HdfsSinkConnectorConfig.HIVE_CONF_DIR_CONFIG);
hiveConf.addResource(new Path(hiveConfDir, "hive-site.xml"));
SessionState.start(new CliSessionState(hiveConf));
cliDriver = new CliDriver();
}