Skip to content

Instantly share code, notes, and snippets.

@milindjagre
Created May 9, 2016 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milindjagre/3a77b5430111ead3eb3f538a5db72210 to your computer and use it in GitHub Desktop.
Save milindjagre/3a77b5430111ead3eb3f538a5db72210 to your computer and use it in GitHub Desktop.
/*
* 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 com.milind.mr.excel;
/**
*
* @author milind
*/
import java.io.IOException;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ExcelMapper extends
Mapper<LongWritable, Text, Text, Text> {
private static Logger LOG = LoggerFactory.getLogger(ExcelMapper.class);
/**
* Excel Spreadsheet is supplied in string form to the mapper. We are simply
* emitting them for viewing on HDFS.
*/
public void map(LongWritable key, Text value, Context context)
throws InterruptedException, IOException {
String line = value.toString();
context.write(new Text(line), null);
LOG.info("Map processing finished");
}
}
@milindjagre
Copy link
Author

This is a Mapper Class which is used for reading Excel file using MapReduce API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment