[ 
https://issues.apache.org/jira/browse/HIVE-25947?focusedWorklogId=729073&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-729073
 ]

ASF GitHub Bot logged work on HIVE-25947:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 17/Feb/22 16:39
            Start Date: 17/Feb/22 16:39
    Worklog Time Spent: 10m 
      Work Description: deniskuzZ commented on a change in pull request #3027:
URL: https://github.com/apache/hive/pull/3027#discussion_r809249306



##########
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:
       minor, however, it looks like a mix of imperative and declarative 
styles, I would prefer streaming API here:
   ````
       return propertyGetters.stream()
         .flatMap(getter -> QUEUE_PROPERTIES.stream()
           .filter(p -> !StringUtils.isEmpty(getter.apply(p))))
         .findFirst()
         .orElse(conf.getVar(HiveConf.ConfVars.COMPACTOR_JOB_QUEUE));
   ```` 




-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 729073)
    Time Spent: 1h 50m  (was: 1h 40m)

> Compactor job queue cannot be set per table via 
> compactor.mapred.job.queue.name
> -------------------------------------------------------------------------------
>
>                 Key: HIVE-25947
>                 URL: https://issues.apache.org/jira/browse/HIVE-25947
>             Project: Hive
>          Issue Type: Bug
>          Components: HiveServer2
>            Reporter: Stamatis Zampetakis
>            Assignee: Stamatis Zampetakis
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Before HIVE-20723 it was possible to schedule the compaction for each table 
> on specific job queues by putting {{compactor.mapred.job.queue.name}} in the 
> table properties. 
> {code:sql}
> CREATE TABLE person (name STRING, age INT) STORED AS ORC TBLPROPERTIES(
> 'transactional'='true',
> 'compactor.mapred.job.queue.name'='root.user2);
> ALTER TABLE person COMPACT 'major' WITH OVERWRITE 
> TBLPROPERTIES('compactor.mapred.job.queue.name'='root.user2')
> {code}
> This is no longer possible (after HIVE-20723) and in order to achieve the 
> same effect someone needs to use the {{compactor.hive.compactor.job.queue}}.
> {code:sql}
> CREATE TABLE person (name STRING, age INT) STORED AS ORC TBLPROPERTIES(
> 'transactional'='true',
> 'compactor.hive.compactor.job.queue'='root.user2);
> ALTER TABLE person COMPACT 'major' WITH OVERWRITE 
> TBLPROPERTIES('compactor.hive.compactor.job.queue'='root.user2')
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to