本文整理了Java中org.apache.hadoop.hive.ql.metadata.Hive.get()
方法的一些代码示例,展示了Hive.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hive.get()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.metadata.Hive
类名称:Hive
方法名:get
[英]Gets hive object for the current thread. If one is not initialized then a new one is created If the new configuration is different in metadata conf vars, or the owner will be different then a new one is created.
[中]
代码示例来源:origin: apache/hive
@Override
public Hive getHive() throws HiveException {
return Hive.get((HiveConf)conf);
}
代码示例来源:origin: apache/hive
@Override
public void run() {
try {
RuntimeStat rec = encode(map);
Hive.get().getMSC().addRuntimeStat(rec);
} catch (TException | HiveException | IOException e) {
logException("Exception while persisting runtime stat", e);
}
}
}
代码示例来源:origin: apache/hive
private static Set<Partition> getAllPartitions(Table tab) throws HiveException {
PerfLogger perfLogger = SessionState.getPerfLogger();
perfLogger.PerfLogBegin(CLASS_NAME, PerfLogger.PARTITION_RETRIEVING);
Set<Partition> result = Hive.get().getAllPartitionsOf(tab);
perfLogger.PerfLogEnd(CLASS_NAME, PerfLogger.PARTITION_RETRIEVING);
return result;
}
代码示例来源:origin: apache/drill
/**
* @return List containing Indexes names if there are indexes on this table
* @throws HiveException
**/
public static List<Index> getAllIndexes(Table table, short max) throws HiveException {
Hive hive = Hive.get();
return hive.getIndexes(table.getTTable().getDbName(), table.getTTable().getTableName(), max);
}
代码示例来源:origin: apache/hive
protected static Map<String, String> getColNameToDefaultValueMap(Table tbl) throws SemanticException {
Map<String, String> colNameToDefaultVal = null;
try {
DefaultConstraint dc = Hive.get().getEnabledDefaultConstraints(tbl.getDbName(), tbl.getTableName());
colNameToDefaultVal = dc.getColNameToDefaultValueMap();
} catch (Exception e) {
if (e instanceof SemanticException) {
throw (SemanticException) e;
} else {
throw (new RuntimeException(e));
}
}
return colNameToDefaultVal;
}
代码示例来源:origin: apache/hive
public static Hive get() throws HiveException {
return get(true);
}
代码示例来源:origin: apache/hive
@Override
public IMetaStoreClient getHiveMetastoreClient() throws HiveAuthzPluginException {
String errMsg = "Error getting metastore client";
try {
return Hive.get().getMSC();
} catch (MetaException e) {
throw new HiveAuthzPluginException(errMsg, e);
} catch (HiveException e) {
throw new HiveAuthzPluginException(errMsg, e);
}
}
代码示例来源:origin: apache/drill
private static Set<Partition> getAllPartitions(Table tab) throws HiveException {
PerfLogger perfLogger = SessionState.getPerfLogger();
perfLogger.PerfLogBegin(CLASS_NAME, PerfLogger.PARTITION_RETRIEVING);
Set<Partition> result = Hive.get().getAllPartitionsOf(tab);
perfLogger.PerfLogEnd(CLASS_NAME, PerfLogger.PARTITION_RETRIEVING);
return result;
}
代码示例来源:origin: apache/hive
private ImmutableMap<String, Long> dumpMetaCallTimingWithoutEx(String phase) {
try {
return Hive.get().dumpAndClearMetaCallTiming(phase);
} catch (HiveException he) {
LOG.warn("Caught exception attempting to write metadata call information " + he, he);
}
return null;
}
代码示例来源:origin: apache/hive
public PrivilegeSynchronizer(LeaderLatch privilegeSynchronizerLatch,
PolicyProviderContainer policyProviderContainer, HiveConf hiveConf) {
this.hiveConf = new HiveConf(hiveConf);
this.hiveConf.set(MetastoreConf.ConfVars.FILTER_HOOK.getVarname(), DefaultMetaStoreFilterHookImpl.class.getName());
try {
hiveClient = Hive.get(this.hiveConf).getMSC();
} catch (Exception e) {
throw new RuntimeException("Error creating HiveMetastoreClient", e);
}
this.privilegeSynchronizerLatch = privilegeSynchronizerLatch;
this.policyProviderContainer = policyProviderContainer;
this.hiveConf = hiveConf;
}
代码示例来源:origin: apache/hive
protected static Hive createHiveDB(HiveConf conf) throws SemanticException {
try {
return Hive.get(conf);
} catch (HiveException e) {
throw new SemanticException(e);
}
}
代码示例来源:origin: apache/hive
HiveUpdater(HiveConf conf, boolean fileRename) throws HiveException {
hive = Hive.get(conf);
Hive.set(hive);
doFileRename = fileRename;
}
代码示例来源:origin: apache/hive
public void init(Configuration conf) throws HiveException {
hive_db = new HiveProxy(Hive.get(conf, HiveAuthorizationProvider.class));
}
代码示例来源:origin: apache/drill
private ImmutableMap<String, Long> dumpMetaCallTimingWithoutEx(String phase) {
try {
return Hive.get().dumpAndClearMetaCallTiming(phase);
} catch (HiveException he) {
LOG.warn("Caught exception attempting to write metadata call information " + he, he);
}
return null;
}
代码示例来源:origin: apache/hive
public static Hive get(Configuration c, Class<?> clazz) throws HiveException {
return get(c instanceof HiveConf ? (HiveConf)c : new HiveConf(c, clazz));
}
代码示例来源:origin: apache/drill
protected static Hive createHiveDB(HiveConf conf) throws SemanticException {
try {
return Hive.get(conf);
} catch (HiveException e) {
throw new SemanticException(e);
}
}
代码示例来源:origin: apache/hive
/**
* Test basic Hive class interaction, that:
* - We can have different Hive objects throughout the lifetime of this thread.
*/
public void testHiveCloseCurrent() throws Throwable {
Hive hive1 = Hive.get();
Hive.closeCurrent();
Hive hive2 = Hive.get();
Hive.closeCurrent();
assertTrue(hive1 != hive2);
}
代码示例来源:origin: apache/hive
@Override
public void run(HookContext hookContext) throws Exception {
SessionState ss = SessionState.get();
if (ss != null && ss.getConf().get(HiveConf.ConfVars.HIVE_SERVER2_MATERIALIZED_VIEWS_REGISTRY_IMPL.varname)
.equals("DUMMY")) {
HiveMaterializedViewsRegistry.get().init(Hive.get(ss.getConf()));
}
}
代码示例来源:origin: apache/hive
@AfterClass
public static void deInit() throws Exception {
Hive h = Hive.get(conf);
h.dropTable("foo");
}
代码示例来源:origin: apache/hive
private void cancelDelegationToken() throws HiveSQLException {
if (hmsDelegationTokenStr != null) {
try {
Hive.get(getHiveConf()).cancelDelegationToken(hmsDelegationTokenStr);
hmsDelegationTokenStr = null;
getHiveConf().setVar(HiveConf.ConfVars.METASTORE_TOKEN_SIGNATURE, "");
} catch (HiveException e) {
throw new HiveSQLException("Couldn't cancel delegation token", e);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!