Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Reusing your fns as Clojure serialized fns to use in Flambo (Spark wrapper for Clojure)
(require '[clj-time.core :as t])
(require '[flambo.api :as f])
(defn date-filter-fn
"Given a LocalDate, returns a serializable fn that takes a DateTime
object and returns true if the DateTime fields match those of the
provided LocalDate, else returns false."
;; returning a serializable fn to be used with Flambo/Spark's filter operation
(= (t/day local-date) (t/day date-time)))
(= (t/month local-date) (t/month date-time))
(= (t/year local-date) (t/year date-time))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment