 (defmulti ^:private post-process query-type-dispatch-fn)
 
 (defmethod post-process ::select     [_ results] (->> results first :result :events (map :event)))
-(defmethod post-process ::timeseries [_ results] (map :result results))
+(defmethod post-process ::total [_ results] (map :result results))
 (defmethod post-process ::topN       [_ results] (-> results first :result))
 (defmethod post-process ::groupBy    [_ results] (map :event results))
+
+(defmethod post-process ::grouped-timeseries [_ results]
+  (->> results
+    (map (fn [event]
+      (conj {:timestamp (:timestamp event)} (:result event)))))
 
 (defn post-process-native
   "Post-process the results of a *native* Druid query.

                                                     {:dimension (->rvalue field)
                                                      :direction direction}))))


;;; ### handle-fields



(defmulti ^:private handle-breakout query-type-dispatch-fn)

(defmethod handle-breakout ::query [_ _ _]) ; only topN , grouped-timeseries & groupBy handle breakouts

(defmethod handle-breakout ::grouped-timeseries [_ {[breakout-field] :breakout} druid-query]
  (assoc druid-query :granularity (:unit breakout-field)))

(defmethod handle-breakout ::topN [_ {[breakout-field] :breakout} druid-query]
  (assoc druid-query :dimension (->dimension-rvalue breakout-field)))
