How to create hadoop sequence file in local file system without hadoop installation? How to create hadoop sequence file in local file system without hadoop installation? hadoop hadoop

How to create hadoop sequence file in local file system without hadoop installation?


You would need the libraries but not the installation. Use

SequenceFile.Writer

Sample code :

import java.io.IOException;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.fs.FileSystem;import org.apache.hadoop.fs.Path;import org.apache.hadoop.io.NullWritable;import org.apache.hadoop.io.SequenceFile;import org.apache.hadoop.io.Text;public class SequenceFileCreator {    public static void main(String[] args) throws IOException {        // TODO Auto-generated method stub        Configuration config = new Configuration();        FileSystem fs = FileSystem.get(config);        SequenceFile.Writer writer = new SequenceFile.Writer(fs, config, new Path("LocalPath"), NullWritable.class, Text.class);        writer.append(NullWritable.get(), new Text(""));        writer.close();    }}