veghlaci05 commented on code in PR #3513:
URL: https://github.com/apache/hive/pull/3513#discussion_r963439087
##########
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java:
##########
@@ -259,15 +268,32 @@ private void scheduleCompactionIfRequired(CompactionInfo
ci, Table t, Partition
}
}
- private Table resolveTableAndCache(CompactionInfo ci) throws MetaException {
- if (tableCache.isPresent()) {
+ private String getPoolName(CompactionInfo ci, Table t) throws Exception {
+ String poolName =
t.getParameters().get(Constants.HIVE_COMPACTOR_WORKER_POOL);
+ if (StringUtils.isBlank(poolName)) {
+ poolName = obtainObject(ci.dbname, () ->
resolveDatabase(ci)).getParameters().get(Constants.HIVE_COMPACTOR_WORKER_POOL);
+ }
+ return poolName;
+ }
+
+ private <T extends TBase<T,?>> T obtainObject(String key, Callable<T>
callable) throws Exception {
+ if (dbCache.isPresent()) {
try {
- return tableCache.get().get(ci.getFullTableName(), () ->
resolveTable(ci));
+ return (T)dbCache.get().get(key, callable);
} catch (ExecutionException e) {
- throw (MetaException) e.getCause();
+ throw (Exception) e.getCause();
Review Comment:
`e.getCause()` returns `Throwable`, but did not want to declare that in
throws clause, since it will be an `Exception` for sure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]