MAPREDUCE-6819. Replace UTF8 with Text in MRBench. Contributed by Peter Bacsko.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7ee8be1a Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7ee8be1a Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7ee8be1a Branch: refs/heads/YARN-2915 Commit: 7ee8be1aa3f83de524742ae52a40db85ee59ffb0 Parents: a9d946d Author: Akira Ajisaka <aajis...@apache.org> Authored: Tue Jan 17 17:56:10 2017 +0900 Committer: Akira Ajisaka <aajis...@apache.org> Committed: Tue Jan 17 17:56:10 2017 +0900 ---------------------------------------------------------------------- .../java/org/apache/hadoop/mapred/MRBench.java | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/7ee8be1a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/MRBench.java ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/MRBench.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/MRBench.java index 079fad7..aee5003 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/MRBench.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/MRBench.java @@ -29,7 +29,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; -import org.apache.hadoop.io.UTF8; import org.apache.hadoop.io.WritableComparable; import org.apache.hadoop.io.Text; import org.apache.hadoop.util.Tool; @@ -56,14 +55,14 @@ public class MRBench extends Configured implements Tool{ * writes out data as text again. */ public static class Map extends MapReduceBase - implements Mapper<WritableComparable, Text, UTF8, UTF8> { + implements Mapper<WritableComparable<?>, Text, Text, Text> { - public void map(WritableComparable key, Text value, - OutputCollector<UTF8, UTF8> output, + public void map(WritableComparable<?> key, Text value, + OutputCollector<Text, Text> output, Reporter reporter) throws IOException { String line = value.toString(); - output.collect(new UTF8(process(line)), new UTF8("")); + output.collect(new Text(process(line)), new Text("")); } public String process(String line) { return line; @@ -74,13 +73,14 @@ public class MRBench extends Configured implements Tool{ * Ignores the key and writes values to the output. */ public static class Reduce extends MapReduceBase - implements Reducer<UTF8, UTF8, UTF8, UTF8> { + implements Reducer<Text, Text, Text, Text> { - public void reduce(UTF8 key, Iterator<UTF8> values, - OutputCollector<UTF8, UTF8> output, Reporter reporter) throws IOException + public void reduce(Text key, Iterator<Text> values, + OutputCollector<Text, Text> output, + Reporter reporter) throws IOException { while(values.hasNext()) { - output.collect(key, new UTF8(values.next().toString())); + output.collect(key, new Text(values.next().toString())); } } } @@ -151,10 +151,10 @@ public class MRBench extends Configured implements Tool{ jobConf.setInputFormat(TextInputFormat.class); jobConf.setOutputFormat(TextOutputFormat.class); - jobConf.setOutputValueClass(UTF8.class); + jobConf.setOutputValueClass(Text.class); - jobConf.setMapOutputKeyClass(UTF8.class); - jobConf.setMapOutputValueClass(UTF8.class); + jobConf.setMapOutputKeyClass(Text.class); + jobConf.setMapOutputValueClass(Text.class); if (null != jarFile) { jobConf.setJar(jarFile); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org