             [flambo.conf :as conf]
             [flambo.utils :as u]
             [flambo.kryo :as k])
-  (:import (scala Tuple2)
-           [scala.reflect ClassTag$]
-           (java.util Comparator)
-           (org.apache.spark.api.java JavaSparkContext StorageLevels
-                                      JavaRDD JavaDoubleRDD)
-           (org.apache.spark.rdd PartitionwiseSampledRDD)
-           (flambo.function Function Function2 Function3 VoidFunction FlatMapFunction
-                            PairFunction PairFlatMapFunction)))
+  (:import [scala Tuple2]
+           [java.util Comparator]
+           [org.apache.spark.api.java JavaSparkContext StorageLevels
+            JavaRDD JavaDoubleRDD]
+           [org.apache.spark.rdd PartitionwiseSampledRDD]))
 
 ;; flambo makes extensive use of kryo to serialize and deserialize clojure functions
 ;; and data structures. Here we ensure that these properties are set so they are inhereted


(defn flat-map
  "Similar to `map`, but each input item can be mapped to 0 or more output items (so the
   function `f` should return a collection rather than a single item)"
  [rdd f]
  (.flatMap rdd (flat-map-function f)))


  [rdd cnt]
  (.take rdd cnt))

  (defmulti histogram "compute histogram of an RDD of doubles"
    (fn [_ bucket-arg] (sequential? bucket-arg)))

(defmethod histogram true [rdd buckets]
  (let [counts (-> (JavaDoubleRDD/fromRDD (.rdd rdd))
                   (.histogram (double-array buckets)))]
    (into [] counts)))

(defmethod histogram false [rdd bucket-count]
  (let [[buckets counts] (-> (JavaDoubleRDD/fromRDD (.rdd rdd))
