Skip to content

Instantly share code, notes, and snippets.

@robinkraft
Last active December 15, 2015 04:18
Show Gist options
  • Save robinkraft/5200079 to your computer and use it in GitHub Desktop.
Save robinkraft/5200079 to your computer and use it in GitHub Desktop.
Cascading template tap example using Cascalog
;; dumps data into directories based on template, à la
;; /tmp/test-template/2012-01-01/a/part-00000
;; /tmp/test-template/2012-01-01/b/part-00000
;; /tmp/test-template/2013-12-31/a/part-00000
(let [src [["2012-01-01" "a" 2]
["2012-01-01" "b" 3]
["2013-12-31" "a" 4]]]
(?- (hfs-seqfile "/tmp/test-template"
:sink-template "%s/%s"
:templatefields ["?a" "?b"]
:outfields ["?c"])
(<- [?a ?b ?c]
(src ?a ?b ?c))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment