Skip to content
Snippets Groups Projects
Commit a287ceb9 authored by Ryan Senior's avatar Ryan Senior
Browse files

Add a "Don't bin" strategy to the table API response

The mbql clause is nil, so when chosen it will not change or add to
the query in any way.
parent f6e84c29
Branches
Tags
No related merge requests found
......@@ -98,23 +98,31 @@
["Quarter" "quarter"]
["Quarter of Year" "quarter-of-year"]
["Year" "year"]])
(map (fn [[name params]]
{:name name
:mbql (apply vector "binning-strategy" nil params)
:type "type/Number"})
[default-entry
["Quantized by 10 equally sized bins" ["num-bins" 10]]
["Quantized by 50 equally sized bins" ["num-bins" 50]]
["Quantized by 100 equally sized bins" ["num-bins" 100]]])
(map (fn [[name params]]
{:name name
:mbql (apply vector "binning-strategy" nil params)
:type "type/Coordinate"})
[default-entry
["Quantized by 1 degree" ["bin-width" 1.0]]
["Quantized by 10 degree" ["bin-width" 10.0]]
["Quantized by 20 degree" ["bin-width" 20.0]]
["Quantized by 50 degree" ["bin-width" 50.0]]])))))
(cons
{:name "Don't bin"
:mbql nil
:type "type/Number"}
(map (fn [[name params]]
{:name name
:mbql (apply vector "binning-strategy" nil params)
:type "type/Number"})
[default-entry
["Quantized by 10 equally sized bins" ["num-bins" 10]]
["Quantized by 50 equally sized bins" ["num-bins" 50]]
["Quantized by 100 equally sized bins" ["num-bins" 100]]]))
(cons
{:name "Don't bin"
:mbql nil
:type "type/Coordinate"}
(map (fn [[name params]]
{:name name
:mbql (apply vector "binning-strategy" nil params)
:type "type/Coordinate"})
[default-entry
["Quantized by 1 degree" ["bin-width" 1.0]]
["Quantized by 10 degree" ["bin-width" 10.0]]
["Quantized by 20 degree" ["bin-width" 20.0]]
["Quantized by 50 degree" ["bin-width" 50.0]]]))))))
(def ^:private dimension-options-for-response
(m/map-kv (fn [k v]
......
......@@ -641,7 +641,7 @@
;; Lat/Long fields should use bin-width rather than num-bins
(expect
(if (data/binning-supported?)
#{"bin-width" "default"}
#{nil "bin-width" "default"}
#{})
(let [response ((user->client :rasta) :get 200 (format "table/%d/query_metadata" (data/id :venues)))]
(extract-dimension-options response "LATITUDE")))
......@@ -649,7 +649,7 @@
;; Number columns without a special type should use "num-bins"
(expect
(if (data/binning-supported?)
#{"num-bins" "default"}
#{nil "num-bins" "default"}
#{})
(let [{:keys [special_type]} (Field (data/id :venues :price))]
(try
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment