-
-
Save ngvinay/2aa60f66f6c28be4fe6aa7620d7f59f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.apache.hadoop.conf.Configuration; | |
| import org.apache.hadoop.conf.Configured; | |
| import org.apache.hadoop.fs.Path; | |
| import org.apache.hadoop.hive.ql.io.orc.OrcNewOutputFormat; | |
| import org.apache.hadoop.io.NullWritable; | |
| import org.apache.hadoop.io.Writable; | |
| import org.apache.hadoop.mapreduce.Job; | |
| import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; | |
| import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; | |
| import org.apache.hadoop.util.Tool; | |
| import org.apache.hadoop.util.ToolRunner; | |
| public class FileMapperDriver extends Configured implements Tool{ | |
| public static void main(String[] args) throws Exception { | |
| ToolRunner.run(new FileMapperDriver(), args); | |
| } | |
| @Override | |
| public int run(String[] args) throws Exception { | |
| Configuration conf = this.getConf(); | |
| Job job = Job.getInstance(conf); | |
| job.setJarByClass(FileMapperDriver.class); | |
| job.setMapperClass(FileMapper.class); | |
| job.setNumReduceTasks(0); | |
| job.setInputFormatClass(TextInputFormat.class); | |
| FileInputFormat.addInputPath(job, new Path(args[0])); | |
| job.setOutputFormatClass(OrcNewOutputFormat.class); | |
| OrcNewOutputFormat.setOutputPath(job, new Path(args[1])); | |
| job.setOutputKeyClass(NullWritable.class); | |
| job.setOutputValueClass(Writable.class); | |
| job.waitForCompletion(true); | |
| return 0; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment