Analysis.A7_Total_Signups_By_Year.Total_Signup_by_Year_Driver.java Source code

Java tutorial

Introduction

Here is the source code for Analysis.A7_Total_Signups_By_Year.Total_Signup_by_Year_Driver.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Analysis.A7_Total_Signups_By_Year;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

/**
 *
 * @author Chintan
 */
public class Total_Signup_by_Year_Driver {

    /**
     * @param args the command line arguments
     */

    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf, "Total Signups by Year");
        job.setJarByClass(Total_Signup_by_Year_Driver.class);
        job.setMapperClass(Total_Signup_by_Year_Mapper.class);

        job.setCombinerClass(Total_Signup_by_Year_Reducer.class);
        job.setReducerClass(Total_Signup_by_Year_Reducer.class);

        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(IntWritable.class);

        FileInputFormat.addInputPath(job, new Path(args[0]));
        FileOutputFormat.setOutputPath(job, new Path(args[1]));
        System.exit(job.waitForCompletion(true) ? 0 : 1);
    }
}