From 1d5c796d654c8959972d15cc6742731a99380bfc Mon Sep 17 00:00:00 2001 From: Harsh J Date: Sun, 22 Mar 2015 10:03:25 +0530 Subject: [PATCH] MAPREDUCE-5190. Unnecessary condition test in RandomSampler. Contributed by Jingguo Yao. --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../apache/hadoop/mapreduce/lib/partition/InputSampler.java | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 29208117b8..e98aacd95f 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -256,6 +256,9 @@ Release 2.8.0 - UNRELEASED IMPROVEMENTS + MAPREDUCE-5190. Unnecessary condition test in RandomSampler. + (Jingguo Yao via harsh) + MAPREDUCE-6239. Consolidate TestJobConf classes in hadoop-mapreduce-client-jobclient and hadoop-mapreduce-client-core (Varun Saxena via harsh) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/partition/InputSampler.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/partition/InputSampler.java index 4668f49cc2..cce9f37838 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/partition/InputSampler.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/partition/InputSampler.java @@ -230,10 +230,8 @@ public K[] getSample(InputFormat inf, Job job) // to reflect the possibility of existing elements being // pushed out int ind = r.nextInt(numSamples); - if (ind != numSamples) { - samples.set(ind, ReflectionUtils.copy(job.getConfiguration(), - reader.getCurrentKey(), null)); - } + samples.set(ind, ReflectionUtils.copy(job.getConfiguration(), + reader.getCurrentKey(), null)); freq *= (numSamples - 1) / (double) numSamples; } }