Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@

HadoopShims.MiniDFSShim cluster = null;
final boolean storagePolicy;
private static final String DEFAULT = "default";
private static final String MAPRED_JOB_QUEUE_NAME = "mapred.job.queue.name";

public Hadoop23Shims() {
// in-memory HDFS
Expand Down Expand Up @@ -304,7 +306,7 @@
this.conf = new Configuration(conf);

JobConf jConf = new JobConf(conf);
jConf.set("yarn.scheduler.capacity.root.queues", "default");

Check failure on line 309 in shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use already-defined constant 'DEFAULT' instead of duplicating its value here.

See more on https://sonarcloud.io/project/issues?id=apache_hive&issues=AZ7NPer15Q7KycXfKuo_&open=AZ7NPer15Q7KycXfKuo_&pullRequest=6543
jConf.set("yarn.scheduler.capacity.root.default.capacity", "100");
jConf.setInt(MRJobConfig.MAP_MEMORY_MB, 512);
jConf.setInt(MRJobConfig.REDUCE_MEMORY_MB, 512);
Expand Down Expand Up @@ -1238,6 +1240,13 @@
* of these details.
*/
protected void ensureMapReduceQueue(Configuration conf) {
String mapredQueue = conf.getRaw(MAPRED_JOB_QUEUE_NAME);
if (StringUtils.isNotEmpty(mapredQueue) && !DEFAULT.equals(mapredQueue)) {
LOG.info("DistCp: setting mapreduce.job.queuename to '{}' from mapred.job.queue.name", mapredQueue);
conf.set(MRJobConfig.QUEUE_NAME, mapredQueue);
return;
}

String queueName = conf.get(TezConfiguration.TEZ_QUEUE_NAME);
boolean isTez = "tez".equalsIgnoreCase(conf.get("hive.execution.engine"));
boolean shouldMapredJobsFollowTezQueue = conf.getBoolean("hive.mapred.job.follow.tez.queue", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,22 @@ public void testGetFileIdForNonexistingPath() throws Exception {
@Test
public void testMapReduceQueueIsSetToTezQueue() throws Exception {
Configuration conf = new Configuration();

// mapred.job.queue.name set by replication policy
conf.set("mapred.job.queue.name", "testqueue");
conf.set("hive.execution.engine", "tez");
DistCp distCp = runMockDistCp(conf);
assertEquals("testqueue", distCp.getConf().get(MRJobConfig.QUEUE_NAME));

// there is a tez.queue.name, but hive.mapred.job.follow.tez.queue is not allowed
conf = new Configuration();
conf.set(TezConfiguration.TEZ_QUEUE_NAME, "helloQ");
conf.set("hive.execution.engine", "tez");
DistCp distCp = runMockDistCp(conf);
distCp = runMockDistCp(conf);
assertEquals("default", distCp.getConf().get(MRJobConfig.QUEUE_NAME));

// there is a tez.queue.name, and hive.mapred.job.follow.tez.queue is allowed
conf = new Configuration();
conf.set(TezConfiguration.TEZ_QUEUE_NAME, "helloQ");
conf.setBoolean("hive.mapred.job.follow.tez.queue", true);
conf.set("hive.execution.engine", "tez");
Expand Down