edu.iit.marketbasket.MarketBasket.java Source code

Java tutorial

Introduction

Here is the source code for edu.iit.marketbasket.MarketBasket.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 edu.iit.marketbasket;

import java.io.IOException;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.FileInputFormat;
import org.apache.hadoop.mapred.FileOutputFormat;
import org.apache.hadoop.mapred.JobClient;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.TextInputFormat;
import org.apache.hadoop.mapred.TextOutputFormat;

/**
 *
 * @author supramo
 */
public class MarketBasket {
    public static void main(String[] args) throws IOException {

        JobConf conf = new JobConf(MarketBasket.class);
        conf.setJobName("MarketBasket");
        conf.setMapperClass(Map.class);
        conf.setReducerClass(Reduce.class);
        //conf.setJarByClass(MarketBasket.class);
        conf.setInputFormat(TextInputFormat.class);
        conf.setOutputFormat(TextOutputFormat.class);
        conf.setOutputKeyClass(Text.class);
        conf.setOutputValueClass(IntWritable.class);
        FileInputFormat.setInputPaths(conf, new Path(args[0]));
        FileOutputFormat.setOutputPath(conf, new Path(args[1]));
        JobClient.runJob(conf).waitForCompletion();
    }
}