MAPREDUCE-5190. Unnecessary condition test in RandomSampler. Contributed by Jingguo Yao.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/1d5c796d Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1d5c796d Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1d5c796d Branch: refs/heads/HDFS-7285 Commit: 1d5c796d654c8959972d15cc6742731a99380bfc Parents: b46c2bb Author: Harsh J <ha...@cloudera.com> Authored: Sun Mar 22 10:03:25 2015 +0530 Committer: Harsh J <ha...@cloudera.com> Committed: Sun Mar 22 10:03:25 2015 +0530 ---------------------------------------------------------------------- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../apache/hadoop/mapreduce/lib/partition/InputSampler.java | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/1d5c796d/hadoop-mapreduce-project/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 2920811..e98aacd 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) http://git-wip-us.apache.org/repos/asf/hadoop/blob/1d5c796d/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/partition/InputSampler.java ---------------------------------------------------------------------- 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 4668f49..cce9f37 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 class InputSampler<K,V> extends Configured implements Tool { // 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; } }