Skip to content

Commit

Permalink
Add LZO support.
Browse files Browse the repository at this point in the history
  • Loading branch information
lelayf committed Apr 27, 2012
1 parent 3c83f1f commit f447021
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion project.clj
@@ -1,4 +1,4 @@
(defproject backtype/dfs-datastores "1.1.3-SNAPSHOT" (defproject org.clojars.lelayf/dfs-datastores "1.1.3-SNAPSHOT"
:source-path "src/clj" :source-path "src/clj"
:test-path "test/clj" :test-path "test/clj"
:java-source-path "src/jvm" :java-source-path "src/jvm"
Expand All @@ -16,3 +16,4 @@
[lein-javac "1.3.0"] [lein-javac "1.3.0"]
[lein-junit "1.0.0"] [lein-junit "1.0.0"]
[junit "4.7"]]) [junit "4.7"]])

8 changes: 7 additions & 1 deletion src/jvm/backtype/hadoop/pail/SequenceFileFormat.java
Expand Up @@ -17,6 +17,8 @@
import org.apache.hadoop.io.compress.CompressionCodec; import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.hadoop.io.compress.DefaultCodec; import org.apache.hadoop.io.compress.DefaultCodec;
import org.apache.hadoop.io.compress.GzipCodec; import org.apache.hadoop.io.compress.GzipCodec;
import org.apache.hadoop.io.compress.LzoCodec ;
//import org.apache.hadoop.io.compress.SnappyCodec ;
import org.apache.hadoop.mapred.*; import org.apache.hadoop.mapred.*;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;


Expand All @@ -38,6 +40,8 @@ public class SequenceFileFormat implements PailFormat {
public static final String CODEC_ARG_DEFAULT = "default"; public static final String CODEC_ARG_DEFAULT = "default";
public static final String CODEC_ARG_GZIP = "gzip"; public static final String CODEC_ARG_GZIP = "gzip";
public static final String CODEC_ARG_BZIP2 = "bzip2"; public static final String CODEC_ARG_BZIP2 = "bzip2";
public static final String CODEC_ARG_LZO = "lzo";
// public static final String CODEC_ARG_SNAPPY = "snappy";


private static final Map<String, CompressionType> TYPES = new HashMap<String, CompressionType>() {{ private static final Map<String, CompressionType> TYPES = new HashMap<String, CompressionType>() {{
put(TYPE_ARG_RECORD, CompressionType.RECORD); put(TYPE_ARG_RECORD, CompressionType.RECORD);
Expand All @@ -48,6 +52,8 @@ public class SequenceFileFormat implements PailFormat {
put(CODEC_ARG_DEFAULT, new DefaultCodec()); put(CODEC_ARG_DEFAULT, new DefaultCodec());
put(CODEC_ARG_GZIP, new GzipCodec()); put(CODEC_ARG_GZIP, new GzipCodec());
put(CODEC_ARG_BZIP2, new BZip2Codec()); put(CODEC_ARG_BZIP2, new BZip2Codec());
put(CODEC_ARG_LZO, new LzoCodec());
// put(CODEC_ARG_LZO, new SnappyCodec());
}}; }};


private String _typeArg; private String _typeArg;
Expand All @@ -56,7 +62,7 @@ public class SequenceFileFormat implements PailFormat {
public SequenceFileFormat(Map<String, Object> args) { public SequenceFileFormat(Map<String, Object> args) {
args = new KeywordArgParser() args = new KeywordArgParser()
.add(TYPE_ARG, null, true, TYPE_ARG_RECORD, TYPE_ARG_BLOCK) .add(TYPE_ARG, null, true, TYPE_ARG_RECORD, TYPE_ARG_BLOCK)
.add(CODEC_ARG, CODEC_ARG_DEFAULT, false, CODEC_ARG_DEFAULT, CODEC_ARG_GZIP, CODEC_ARG_BZIP2) .add(CODEC_ARG, CODEC_ARG_DEFAULT, false, CODEC_ARG_DEFAULT, CODEC_ARG_GZIP, CODEC_ARG_BZIP2, CODEC_ARG_LZO)
.parse(args); .parse(args);
_typeArg = (String) args.get(TYPE_ARG); _typeArg = (String) args.get(TYPE_ARG);
_codecArg = (String) args.get(CODEC_ARG); _codecArg = (String) args.get(CODEC_ARG);
Expand Down

0 comments on commit f447021

Please sign in to comment.