use of org.apache.hadoop.hive.common.StringableMap in project hive by apache.
the class CompactorUtil method getCompactorJobQueueName.
/**
* Get the compactor queue name if it's defined.
* @param conf global hive conf
* @param ci compaction info object
* @param table instance of table
* @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);
propertyGetters.add(ciProperties::get);
}
if (table.getParameters() != null) {
propertyGetters.add(table.getParameters()::get);
}
for (Function<String, String> getter : propertyGetters) {
for (String p : QUEUE_PROPERTIES) {
String queueName = getter.apply(p);
if (queueName != null && !queueName.isEmpty()) {
return queueName;
}
}
}
return conf.getVar(HiveConf.ConfVars.COMPACTOR_JOB_QUEUE);
}
Aggregations