         columns (cons (select-keys (:row-column query)
                                    ["title" "type"])
                       category-columns)]
-    {:rows (run-query conn (pivot-sql (:table-name dataset) query filter-str (count categories)))
+    {:rows (run-query conn (pivot-sql (:table-name dataset)
+                                      query
+                                      filter-str
+                                      (count categories)))
      :columns columns}))
 
 (defn apply-empty-query [conn dataset filter-str]

                            (coalesce (get query :category-column))
                            (:table-name dataset)
                            filter-str)
                    (run-query conn)
                    (map second))
        categories (unique-values conn (:table-name dataset) (:category-column query) filter-str)]
    {:columns (cons {"title" ""
                     "type" "text"}
                    (map (fn [category]
                           {"title" category
                            "type" "number"})
                         categories))
     :rows [(cons "Total" counts)]}))

(defn apply-empty-value-query [conn dataset query filter-str]
  (apply-pivot conn

     :rows count}))

(defn apply-empty-category-query [conn dataset query filter-str]
  (let [rows (->> (format "SELECT %s, count(rnum) FROM %s WHERE %s GROUP BY 1 ORDER BY 1"
                          (coalesce (get query :row-column))
                          (:table-name dataset)
                          filter-str)
                  (run-query conn))]
    {:columns [{"type" "text"
                "title" (get-in query [:row-column "title"])}
               {"type" "number"
                "title" "Total"}]
     :rows rows}))
