Skip to content

Instantly share code, notes, and snippets.

@mstump
Created March 14, 2012 01:14
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 mstump/2033166 to your computer and use it in GitHub Desktop.
Save mstump/2033166 to your computer and use it in GitHub Desktop.
;; this one outputs to stdout until it dies due to 'Exceeded max jobconf'
(defn format-package-repo-for-cassandra
[source-type base-attributes sink repo]
(cio/with-fs-tmp [_ tmp]
(let [packages (package-seq repo)]
(if-not (empty? packages)
(let [lazy-tap (ops/lazy-generator tmp packages)]
(?<- (stdout)
[?row-key ?col ?val]
((vec packages) :> ?name _ _ _ _ ?attr)
(format-package-for-output :< source-type base-attributes ?attr :> ?row-key ?col ?val)))))))
;; I get no output to stdout
(defn format-package-repo-for-cassandra
[source-type base-attributes sink repo]
(cio/with-fs-tmp [_ tmp]
(let [packages (package-seq repo)]
(if-not (empty? packages)
(let [lazy-tap (ops/lazy-generator tmp packages)]
(?<- (stdout)
[?row-key ?col ?val]
(lazy-tap :> ?name _ _ _ _ ?attr)
(format-package-for-output :< source-type base-attributes ?attr :> ?row-key ?col ?val)))))))
@mstump
Copy link
Author

mstump commented Mar 15, 2012

This turned out to be a bug in 1.8.6, it's fixed in 1.8.7. lazy-generator wouldn't work with nullable vars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment