Browse files

Got SortByTemperatureUsingTotalOrderPartitioner working against lates…

…t Hadoop branch-1.
  • Loading branch information...
1 parent 461b561 commit 1603d645a2380a61b42558b5853501b2adeaf5e1 @tomwhite committed Feb 4, 2012
View
3 ch07/src/main/examples/SmallFilesToSequenceFileConverter.ignore/input.txt
@@ -1 +1,2 @@
-hadoop SmallFilesToSequenceFileConverter input/smallfiles output
+hadoop SmallFilesToSequenceFileConverter input/smallfiles outputhadoop jar hadoop-examples.jar SmallFilesToSequenceFileConverter \
+ -conf conf/hadoop-localhost.xml -D mapred.reduce.tasks=2 input/smallfiles output
View
9 ch08/src/main/java/SortByTemperatureUsingTotalOrderPartitioner.java
@@ -1,6 +1,7 @@
// cc SortByTemperatureUsingTotalOrderPartitioner A MapReduce program for sorting a SequenceFile with IntWritable keys using the TotalOrderPartitioner to globally sort the data
import java.net.URI;
+import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.filecache.DistributedCache;
import org.apache.hadoop.fs.Path;
@@ -43,12 +44,12 @@ public int run(String[] args) throws Exception {
InputSampler.writePartitionFile(job, sampler);
// Add to DistributedCache
- String partitionFile =
- TotalOrderPartitioner.getPartitionFile(job.getConfiguration());
+ Configuration conf = job.getConfiguration();
+ String partitionFile =TotalOrderPartitioner.getPartitionFile(conf);
URI partitionUri = new URI(partitionFile + "#" +
TotalOrderPartitioner.DEFAULT_PATH);
- job.addCacheFile(partitionUri);
- job.createSymlink();
+ DistributedCache.addCacheFile(partitionUri, conf);
+ DistributedCache.createSymlink(conf);
return job.waitForCompletion(true) ? 0 : 1;
}

0 comments on commit 1603d64

Please sign in to comment.