You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cu...@apache.org on 2006/04/18 19:05:34 UTC
svn commit: r394984 [3/3] - in /lucene/hadoop/trunk: ./ conf/
src/examples/org/apache/hadoop/examples/ src/java/org/apache/hadoop/conf/
src/java/org/apache/hadoop/dfs/ src/java/org/apache/hadoop/fs/
src/java/org/apache/hadoop/io/ src/java/org/apache/ha...
Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MapredLoadTest.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MapredLoadTest.java?rev=394984&r1=394983&r2=394984&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MapredLoadTest.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MapredLoadTest.java Tue Apr 18 10:05:31 2006
@@ -233,14 +233,14 @@
// Write the answer key to a file.
//
FileSystem fs = FileSystem.get(conf);
- File testdir = new File("mapred.loadtest");
+ Path testdir = new Path("mapred.loadtest");
fs.mkdirs(testdir);
- File randomIns = new File(testdir, "genins");
+ Path randomIns = new Path(testdir, "genins");
fs.mkdirs(randomIns);
- File answerkey = new File(randomIns, "answer.key");
- SequenceFile.Writer out = new SequenceFile.Writer(fs, answerkey.getPath(), IntWritable.class, IntWritable.class);
+ Path answerkey = new Path(randomIns, "answer.key");
+ SequenceFile.Writer out = new SequenceFile.Writer(fs, answerkey, IntWritable.class, IntWritable.class);
try {
for (int i = 0; i < range; i++) {
out.append(new IntWritable(i), new IntWritable(dist[i]));
@@ -267,18 +267,18 @@
// Because there's just one reduce task, we emit a single big
// file of random numbers.
//
- File randomOuts = new File(testdir, "genouts");
+ Path randomOuts = new Path(testdir, "genouts");
fs.mkdirs(randomOuts);
JobConf genJob = new JobConf(conf);
- genJob.setInputDir(randomIns);
+ genJob.setInputPath(randomIns);
genJob.setInputKeyClass(IntWritable.class);
genJob.setInputValueClass(IntWritable.class);
genJob.setInputFormat(SequenceFileInputFormat.class);
genJob.setMapperClass(RandomGenMapper.class);
- genJob.setOutputDir(randomOuts);
+ genJob.setOutputPath(randomOuts);
genJob.setOutputKeyClass(IntWritable.class);
genJob.setOutputValueClass(IntWritable.class);
genJob.setOutputFormat(TextOutputFormat.class);
@@ -316,16 +316,16 @@
// you have multiple reduces at once.
//
int intermediateReduces = 10;
- File intermediateOuts = new File(testdir, "intermediateouts");
+ Path intermediateOuts = new Path(testdir, "intermediateouts");
fs.mkdirs(intermediateOuts);
JobConf checkJob = new JobConf(conf);
- checkJob.setInputDir(randomOuts);
+ checkJob.setInputPath(randomOuts);
checkJob.setInputKeyClass(LongWritable.class);
checkJob.setInputValueClass(UTF8.class);
checkJob.setInputFormat(TextInputFormat.class);
checkJob.setMapperClass(RandomCheckMapper.class);
- checkJob.setOutputDir(intermediateOuts);
+ checkJob.setOutputPath(intermediateOuts);
checkJob.setOutputKeyClass(IntWritable.class);
checkJob.setOutputValueClass(IntWritable.class);
checkJob.setOutputFormat(SequenceFileOutputFormat.class);
@@ -341,16 +341,16 @@
// But by having a single reduce task here, we end up merging
// all the files.
//
- File finalOuts = new File(testdir, "finalouts");
+ Path finalOuts = new Path(testdir, "finalouts");
fs.mkdirs(finalOuts);
JobConf mergeJob = new JobConf(conf);
- mergeJob.setInputDir(intermediateOuts);
+ mergeJob.setInputPath(intermediateOuts);
mergeJob.setInputKeyClass(IntWritable.class);
mergeJob.setInputValueClass(IntWritable.class);
mergeJob.setInputFormat(SequenceFileInputFormat.class);
mergeJob.setMapperClass(MergeMapper.class);
- mergeJob.setOutputDir(finalOuts);
+ mergeJob.setOutputPath(finalOuts);
mergeJob.setOutputKeyClass(IntWritable.class);
mergeJob.setOutputValueClass(IntWritable.class);
mergeJob.setOutputFormat(SequenceFileOutputFormat.class);
@@ -366,8 +366,8 @@
// in the original key.
//
boolean success = true;
- File recomputedkey = new File(finalOuts, "part-00000");
- SequenceFile.Reader in = new SequenceFile.Reader(fs, recomputedkey.getPath(), conf);
+ Path recomputedkey = new Path(finalOuts, "part-00000");
+ SequenceFile.Reader in = new SequenceFile.Reader(fs, recomputedkey, conf);
int totalseen = 0;
try {
IntWritable key = new IntWritable();
@@ -407,7 +407,7 @@
//
// Write to "results" whether the test succeeded or not.
//
- File resultFile = new File(testdir, "results");
+ Path resultFile = new Path(testdir, "results");
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fs.create(resultFile)));
try {
bw.write("Success=" + success + "\n");
Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestSequenceFileInputFormat.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestSequenceFileInputFormat.java?rev=394984&r1=394983&r2=394984&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestSequenceFileInputFormat.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestSequenceFileInputFormat.java Tue Apr 18 10:05:31 2006
@@ -34,8 +34,8 @@
public void testFormat() throws Exception {
JobConf job = new JobConf(conf);
FileSystem fs = FileSystem.getNamed("local", conf);
- File dir = new File(System.getProperty("test.build.data",".") + "/mapred");
- File file = new File(dir, "test.seq");
+ Path dir = new Path(System.getProperty("test.build.data",".") + "/mapred");
+ Path file = new Path(dir, "test.seq");
Reporter reporter = new Reporter() {
public void setStatus(String status) throws IOException {}
@@ -47,7 +47,7 @@
fs.delete(dir);
- job.setInputDir(dir);
+ job.setInputPath(dir);
// for a variety of lengths
for (int length = 0; length < MAX_LENGTH;
@@ -57,7 +57,7 @@
// create a file with length entries
SequenceFile.Writer writer =
- new SequenceFile.Writer(fs, file.toString(),
+ new SequenceFile.Writer(fs, file,
IntWritable.class, BytesWritable.class);
try {
for (int i = 0; i < length; i++) {
Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestTextInputFormat.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestTextInputFormat.java?rev=394984&r1=394983&r2=394984&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestTextInputFormat.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestTextInputFormat.java Tue Apr 18 10:05:31 2006
@@ -34,8 +34,8 @@
public void testFormat() throws Exception {
JobConf job = new JobConf(conf);
FileSystem fs = FileSystem.getNamed("local", conf);
- File dir = new File(System.getProperty("test.build.data",".") + "/mapred");
- File file = new File(dir, "test.txt");
+ Path dir = new Path(System.getProperty("test.build.data",".") + "/mapred");
+ Path file = new Path(dir, "test.txt");
Reporter reporter = new Reporter() {
public void setStatus(String status) throws IOException {}
@@ -46,7 +46,7 @@
Random random = new Random(seed);
fs.delete(dir);
- job.setInputDir(dir);
+ job.setInputPath(dir);
// for a variety of lengths
for (int length = 0; length < MAX_LENGTH;