@@ -0,0 +1,3279 @@
+/*%0A * Licensed to the University of California, Berkeley under one or more contributor license%0A * agreements. See the NOTICE file distributed with this work for additional information regarding%0A * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance with the License. You may obtain a%0A * copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software distributed under the License%0A * is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express%0A * or implied. See the License for the specific language governing permissions and limitations under%0A * the License.%0A */%0A%0Apackage tachyon.examples.keyvalue.hadoop;%0A%0Aimport java.io.IOException;%0Aimport java.util.Iterator;%0A%0Aimport org.apache.hadoop.fs.Path;%0Aimport org.apache.hadoop.io.BytesWritable;%0Aimport org.apache.hadoop.mapred.FileInputFormat;%0Aimport org.apache.hadoop.mapred.FileOutputFormat;%0Aimport org.apache.hadoop.mapred.JobClient;%0Aimport org.apache.hadoop.mapred.JobConf;%0Aimport org.apache.hadoop.mapred.MapReduceBase;%0Aimport org.apache.hadoop.mapred.Mapper;%0Aimport org.apache.hadoop.mapred.OutputCollector;%0Aimport org.apache.hadoop.mapred.Reducer;%0Aimport org.apache.hadoop.mapred.Reporter;%0A%0Aimport tachyon.client.keyvalue.hadoop.KeyValueInputFormat;%0Aimport tachyon.client.keyvalue.hadoop.KeyValueOutputCommitter;%0Aimport tachyon.client.keyvalue.hadoop.KeyValueOutputFormat;%0A%0A/**%0A * This boring MapReduce job clones a key-value store to a different URI.%0A */%0Apublic class CloneKeyValueStore %7B%0A  /**%0A   * The mapper emits all key-value pairs it receives to reducers.%0A   */%0A  public static class Map extends MapReduceBase%0A      implements Mapper%3CBytesWritable, BytesWritable, BytesWritable, BytesWritable%3E %7B%0A    @Override%0A    public void map(BytesWritable key, BytesWritable value,%0A        OutputCollector%3CBytesWritable, BytesWritable%3E out, Reporter reporter) throws IOException %7B%0A      out.collect(key, value);%0A    %7D%0A  %7D%0A%0A  /**%0A   * The reducer writes all key-value pairs it receives to the new key-value store.%0A   */%0A  public static class Reduce extends MapReduceBase%0A      implements Reducer%3CBytesWritable, BytesWritable, BytesWritable, BytesWritable%3E %7B%0A    @Override%0A    public void reduce(BytesWritable key, Iterator%3CBytesWritable%3E values,%0A        OutputCollector%3CBytesWritable, BytesWritable%3E out, Reporter reporter) throws IOException %7B%0A      while (values.hasNext()) %7B%0A        out.collect(key, values.next());%0A      %7D%0A    %7D%0A  %7D%0A%0A  public static void main(String%5B%5D args) throws Exception %7B%0A    JobConf conf = new JobConf(CloneKeyValueStore.class);%0A    conf.setJobName(%22clone key-value store%22);%0A%0A    conf.setOutputKeyClass(BytesWritable.class);%0A    conf.setOutputValueClass(BytesWritable.class);%0A%0A    conf.setMapperClass(Map.class);%0A    conf.setReducerClass(Reduce.class);%0A%0A    conf.setInputFormat(KeyValueInputFormat.class);%0A    conf.setOutputFormat(KeyValueOutputFormat.class);%0A    conf.setOutputCommitter(KeyValueOutputCommitter.class);%0A%0A    FileInputFormat.setInputPaths(conf, new Path(args%5B0%5D));%0A    FileOutputFormat.setOutputPath(conf, new Path(args%5B1%5D));%0A%0A    JobClient.runJob(conf);%0A  %7D%0A%7D%0A

Add an example illustrating the usage of key-value input/output format