Skip to content

Use with cascalog

isaiah edited this page Mar 5, 2012 · 1 revision

How to use with cascalog

With the new cascading support, elephant-bird can be used with cascalog now.

(defn lzo-protobuf-block
  [^Class proto-class]
  (LzoProtobufBlockScheme. proto-class))

(defn hfs-lzo-protobuf-block
  "Create a tap on HDFS using protobuf format.
  Supports keyword option for `:outfields`. See `cascalog.tap/hfs-tap`
  for more keyword arguments."
  [path klass & opts]
  (apply tap/hfs-tap (lzo/lzo-protobuf-block klass) path opts))

(defn -main
  [input]
  (with-serializations [ProtobufSerialization]
    (let [s (hfs-lzo-protobuf-block input klass)]
        (?<- (stdout) [?line] (s ?line)))))