 (defn time [ms]
   (Time. ms))
 
-(defn streaming-context 
+(defn streaming-context
   "conf can be a SparkConf or JavaSparkContext"
   [conf batch-duration]
   (JavaStreamingContext. conf (duration batch-duration)))

                                     function2
                                     pair-function
                                     void-function]])
  (:import [org.apache.spark.streaming.api.java JavaStreamingContext]
           [org.apache.spark.streaming.kafka KafkaUtils]
           [org.apache.spark.streaming Duration Time]))



(defn reduce-by-key [dstream f]
  "Call reduceByKey on dstream of type JavaDStream or JavaPairDStream"
  (if (instance? JavaDStream dstream)
    ;; JavaDStream doesn't have a .reduceByKey so cast to JavaPairDStream first
    (-> dstream
      (.mapToPair (pair-function identity))
