sabari
sabari

Reputation: 79

read csv file format in hadoop using java code

How to read CSV file formats in Hadoop using Java code in eclipse IDE?

I have very large file in CSV format and i want to access the CSV file in HDFS in order to perform map reduce program. kindly anyone help me in solving the problem.

I want Java code to access the file .

thanks in advance.

Upvotes: 0

Views: 3662

Answers (2)

Kishore
Kishore

Reputation: 5891

Create you own CSVInputFormat CSVInputFormat

Upvotes: 0

YoungHobbit
YoungHobbit

Reputation: 13402

You can pass the file as input to the mapper. The lines of the file will become value to the mapper.

class FileMapper extends Mapper<LongWritable, Text> {
    @Override
    public void map(LongWritable key, Text value, Context context) {
    // process your CSV records here.
    }
}

Upvotes: 1

Related Questions