How to move files in a Hadoop program?

I want to be able to write to multiple directories from same reducer output. I am using MultipleOutput to write to multiple files. Now, I want to move those files to different directories. How to do that in a Hadoop MapReduce program in Java?

Answers


It's very easy. Use FileSystem.rename. E.g.,

    Configuration conf = ...;
    Job job = ...;
    Path output = new Path("your_map_reduce_output_dir");
    // ...
    if(job.waitForCompletion(true)) {
        FileSystem fs = FileSystem.get(conf);
        Path dest = new Path("your_dest_dir");
        return fs.rename(output, dest);
    }
    else {
        return false;
    }

Need Your Help

C++: Sum of all node values of a binary tree

c++ data-structures

I'm preparing for a job interview. I was stuck at one of the binary tree questions:

Looping through Elements

jquery function loops

Hey guys, I want to make a function loop over all elements that have the class of ".block-header-tabs" and do the following: