From 2cd24312893ea0b8518aa8c16dd2477f19ed2526 Mon Sep 17 00:00:00 2001 From: Harsh J Date: Mon, 23 Mar 2015 03:48:36 +0530 Subject: [PATCH] MAPREDUCE-6287. Deprecated methods in org.apache.hadoop.examples.Sort. Contributed by Chao Zhang. (cherry picked from commit b375d1fc936913edf4a75212559f160c41043906) --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/examples/Sort.java | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 5ebf835c3ce..e399d3ed3e1 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -8,6 +8,9 @@ Release 2.8.0 - UNRELEASED IMPROVEMENTS + MAPREDUCE-6287. Deprecated methods in org.apache.hadoop.examples.Sort + (Chao Zhang via harsh) + MAPREDUCE-5190. Unnecessary condition test in RandomSampler. (Jingguo Yao via harsh) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/Sort.java b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/Sort.java index a90c02b0e3a..0382c09c780 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/Sort.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/Sort.java @@ -24,7 +24,7 @@ import java.util.*; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; -import org.apache.hadoop.mapreduce.filecache.DistributedCache; +import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.BytesWritable; import org.apache.hadoop.io.Writable; @@ -160,13 +160,14 @@ public class Sort extends Configured implements Tool { System.out.println("Sampling input to effect total-order sort..."); job.setPartitionerClass(TotalOrderPartitioner.class); Path inputDir = FileInputFormat.getInputPaths(job)[0]; - inputDir = inputDir.makeQualified(inputDir.getFileSystem(conf)); + FileSystem fs = inputDir.getFileSystem(conf); + inputDir = inputDir.makeQualified(fs.getUri(), fs.getWorkingDirectory()); Path partitionFile = new Path(inputDir, "_sortPartitioning"); TotalOrderPartitioner.setPartitionFile(conf, partitionFile); InputSampler.writePartitionFile(job, sampler); URI partitionUri = new URI(partitionFile.toString() + "#" + "_sortPartitioning"); - DistributedCache.addCacheFile(partitionUri, conf); + job.addCacheFile(partitionUri); } System.out.println("Running on " +