zabetak commented on a change in pull request #3027:
URL: https://github.com/apache/hive/pull/3027#discussion_r809266279
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorUtil.java
##########
@@ -62,31 +75,29 @@ public static ExecutorService
createExecutorWithThreadFactory(int parallelism, S
* @param conf global hive conf
* @param ci compaction info object
* @param table instance of table
- * @return name of the queue, can be null
+ * @return name of the queue
*/
static String getCompactorJobQueueName(HiveConf conf, CompactionInfo ci,
Table table) {
// Get queue name from the ci. This is passed through
// ALTER TABLE table_name COMPACT 'major' WITH OVERWRITE
TBLPROPERTIES('compactor.hive.compactor.job.queue'='some_queue')
+ List<Function<String, String>> propertyGetters = new ArrayList<>(2);
if (ci.properties != null) {
StringableMap ciProperties = new StringableMap(ci.properties);
- String queueName = ciProperties.get(COMPACTOR_PREFIX +
MAPRED_QUEUE_NAME);
- if (queueName != null && queueName.length() > 0) {
- return queueName;
- }
+ propertyGetters.add(ciProperties::get);
}
-
- // Get queue name from the table properties
- String queueName = table.getParameters().get(COMPACTOR_PREFIX +
MAPRED_QUEUE_NAME);
- if (queueName != null && queueName.length() > 0) {
- return queueName;
+ if (table.getParameters() != null) {
+ propertyGetters.add(table.getParameters()::get);
}
- // Get queue name from global hive conf
- queueName = conf.get(HiveConf.ConfVars.COMPACTOR_JOB_QUEUE.varname);
- if (queueName != null && queueName.length() > 0) {
- return queueName;
+ for (Function<String, String> getter : propertyGetters) {
Review comment:
The order in this piece of code is important thus I think the imperative
style fits better here. I guess it boils down to personal preferences so unless
you feel strongly about this I am inclined to keep it as is.
--
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]