                                            :fetch-size Integer/MAX_VALUE}))]
                            (when rows
                              (doseq [row rows]
-                               (let [time (:time row)
+                               (let [time (long (:time row))
                                      metric-raw (:data row)
                                      metric (if (> (count metric-raw) 1)
                                               (agg-fn metric-raw)
                                               (first metric-raw))]
-                                 (aset points (to-ndx time) metric)))
+                                 (aset points (time-to-ndx from rollup time)
+                                       metric)))
                              (swap! series (fn [m] (assoc m % (vec points))))))
                          (catch  Exception e
                            (info e "Fetching exception"))))

      (throw (ex-info "Too long!" {})))
    result))

(defn time-to-ndx
  [^long min-point ^long rollup ^long time]
  (/ (- time min-point) rollup))

(defn par-fetch
  "Fetch data in parallel fashion."
  [session fetch! paths tenant rollup period from to]
  (let [to-ndx (partial time-to-ndx from rollup)
        asize (inc (to-ndx to))
        series (atom {})
        futures
        (doall (map #(future

            [clojure.tools.logging       :refer [error info debug]]
            [lamina.core                 :refer [channel receive-all]]
            [clojure.core.async :as async :refer [<! >! go chan]]
            [cheshire.core :as json])
  (:import [com.datastax.driver.core
            BatchStatement
            PreparedStatement]))
