Changeset 28


Ignore:
Timestamp:
Jul 3, 2008, 5:40:27 PM (16 years ago)
Author:
waue
Message:

resolve 0.17 ->0.16 problem . all? not sure ! XD

Location:
sample/hadoop-0.16/tw/org/nchc
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • sample/hadoop-0.16/tw/org/nchc/demo/DemoWordCountTuple.java

    r27 r28  
    163163    conf.setNumReduceTasks(numReduceTasks);
    164164    // 0.16
    165     // conf.setInputPath(new Path(inPath));
    166     Convert.setInputPath(conf, new Path(inPath));
     165    conf.setInputPath(new Path(inPath));
    167166    conf.setInputFormat(SequenceFileInputFormat.class);
    168167
    169     // conf.setOutputPath(new Path(outputPath));
    170     Convert.setInputPath(conf, new Path(outputPath));
     168    conf.setOutputPath(new Path(outputPath));
    171169    conf.setOutputKeyClass(Tuple.class);
    172170    conf.setOutputValueClass(IntWritable.class);
  • sample/hadoop-0.16/tw/org/nchc/demo/DemoWordCountTuple2.java

    r27 r28  
    125125   
    126126    // 0.16
    127 //    conf.setInputPath(new Path(inPath));
    128     Convert.setInputPath(conf,new Path(inPath));
     127    conf.setInputPath(new Path(inPath));
     128//    Convert.setInputPath(conf,new Path(inPath));
    129129    conf.setInputFormat(SequenceFileInputFormat.class);
    130130    // 0.16
    131 //    conf.setOutputPath(new Path(outputPath));
    132     Convert.setInputPath(conf, new Path(outputPath));
     131    conf.setOutputPath(new Path(outputPath));
     132    //    Convert.setInputPath(conf, new Path(outputPath));
     133
    133134   
    134135    conf.setOutputKeyClass(Tuple.class);
  • sample/hadoop-0.16/tw/org/nchc/util/SequenceFileProcessor.java

    r25 r28  
    1919import java.io.IOException;
    2020
     21import org.apache.hadoop.fs.FileStatus;
    2122import org.apache.hadoop.fs.FileSystem;
    2223import org.apache.hadoop.fs.Path;
     
    118119
    119120  private void run() throws IOException {
    120     if (!FileSystem.get(conf).isFile(mPath)) {
    121       for (Path p : FileSystem.get(conf).listPaths(new Path[] { mPath })) {
     121    FileSystem fs = FileSystem.get(conf);
     122    if (!fs.isFile(mPath)) {
     123            for (Path p : listPaths(fs,mPath)) {
    122124        // System.out.println("Applying to " + p);
    123125        applyToFile(p);
     
    128130
    129131  }
    130 
     132  static public Path[] listPaths(FileSystem fsm,Path path) throws IOException
     133  {
     134    FileStatus[] fss = fsm.listStatus(path);
     135    int length = fss.length;
     136    Path[] pi = new Path[length];
     137    for (int i=0 ; i< length; i++)
     138    {
     139      pi[i] = fss[i].getPath();
     140    }
     141    return pi;
     142  }
    131143  @SuppressWarnings("unchecked")
    132144  private void applyToFile(Path path) throws IOException {
Note: See TracChangeset for help on using the changeset viewer.