adjusted SequenceFileReader to print the sequence file content in stdout
This commit is contained in:
parent
3fb0f26393
commit
027176a88b
|
@ -0,0 +1 @@
|
|||
Main-Class: com.github.sakserv.sequencefile.SequenceFileReader
|
21
pom.xml
21
pom.xml
|
@ -34,6 +34,11 @@
|
|||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
|
@ -149,7 +154,21 @@
|
|||
</resources>
|
||||
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>java</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<mainClass>com.github.sakserv.sequencefile.SequenceFileReader</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
|
|
|
@ -16,19 +16,13 @@ package com.github.sakserv.sequencefile;
|
|||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.io.IntWritable;
|
||||
import org.apache.hadoop.io.SequenceFile;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class SequenceFileReader {
|
||||
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SequenceFileReader.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String inputFile = args[0];
|
||||
|
@ -42,15 +36,16 @@ public class SequenceFileReader {
|
|||
SequenceFile.Reader.file(seqFilePath));
|
||||
|
||||
Text key = new Text();
|
||||
IntWritable val = new IntWritable();
|
||||
Text val = new Text();
|
||||
|
||||
while (reader.next(key, val)) {
|
||||
LOG.info("Sequence File Data: Key: " + key + "\tValue: " + val);
|
||||
//LOG.info(val);
|
||||
System.out.println(val);
|
||||
}
|
||||
|
||||
reader.close();
|
||||
} catch(IOException e) {
|
||||
LOG.error("ERROR: Could not load hadoop configuration");
|
||||
System.err.println("ERROR: Could not load hadoop configuration");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue