Skip to content

Instantly share code, notes, and snippets.

Created April 17, 2013 00:50
Show Gist options
  • Save anonymous/5400914 to your computer and use it in GitHub Desktop.
Save anonymous/5400914 to your computer and use it in GitHub Desktop.
(ns cascalog-tutorial.core
(:use cascalog.api
cascalog.playground
[cheshire.core :only [parse-string]]))
(def my-tap
(hfs-tap (cascading.scheme.hadoop.TextLine.)
(str (System/getProperty "user.dir")
"/records.json")))
(defn count-data [json]
(let [record (parse-string json true)]
(count (:data record []))))
(defn -main []
(?<- (stdout) ; destination
[?c] ; projection
(my-tap _ ?line)
(count-data ?line :> ?c))) ; pattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment