Skip to content

Instantly share code, notes, and snippets.

@sorenmacbeth
Created December 13, 2011 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorenmacbeth/1474287 to your computer and use it in GitHub Desktop.
Save sorenmacbeth/1474287 to your computer and use it in GitHub Desktop.
(ns ybot.analytics.edb
(:use [ybot bootstrap datastores])
(:use elephantdb.cascalog.core)
(:import [elephantdb.persistence JavaBerkDB]
[org.apache.hadoop.io BytesWritable]))
(bootstrap-ybot)
(defn ser-long [val]
(BytesWritable. (.getBytes (str val))))
(defn url-counts [root]
(let [ga (select-fields (gadata-tap root) "!url")
counts (<- [?url ?count]
(ga ?url)
(c/count ?count))]
(<- [?key ?val]
(counts ?key ?rawval)
(ser-long ?rawval :> ?val))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment