Skip to content
Snippets Groups Projects
Commit 5248c9ec authored by Cam Saül's avatar Cam Saül
Browse files

Merge pull request #2651 from metabase/fix-druid-max-aggregation

Fix :max aggregations for Druid :lightning:
parents 72a22051 f3a737dd
Branches
Tags
No related merge requests found
......@@ -112,11 +112,11 @@
(defn- ag:doubleMax [field]
(case (dimension-or-metric? field)
:metric {:type :doubleMin
:name :min
:metric {:type :doubleMax
:name :max
:fieldName (->rvalue field)}
:dimension {:type :javascript
:name :min
:name :max
:fieldNames [(->rvalue field)]
:fnReset "function() { return Number.MIN_VALUE ; }"
:fnAggregate "function(current, x) { return Math.max(current, (parseFloat(x) || Number.MIN_VALUE)); }"
......
......@@ -25,7 +25,7 @@
[]
(doseq [engine event-based-dbs]
(datasets/with-engine-when-testing engine
(data/do-with-temp-db (flattened-db-def) (fn [& _])))))
(data/do-with-temp-db (flattened-db-def) (constantly nil)))))
(defmacro ^:private with-flattened-dbdef [& body]
`(data/with-temp-db [~'_ (flattened-db-def)]
......@@ -679,11 +679,19 @@
;;; MIN & MAX
;; tests for dimension columns
(expect-with-timeseries-dbs [4.0] (first-row (data/run-query checkins
(ql/aggregation (ql/max $venue_price)))))
(expect-with-timeseries-dbs [1.0] (first-row (data/run-query checkins
(ql/aggregation (ql/min $venue_price)))))
(ql/aggregation (ql/min $venue_price)))))
(expect-with-timeseries-dbs [4.0] (first-row (data/run-query checkins
(ql/aggregation (ql/max $venue_price)))))
;; tests for metric columns
(expect-with-timeseries-dbs [1.0] (first-row (data/run-query checkins
(ql/aggregation (ql/max $count)))))
(expect-with-timeseries-dbs [1.0] (first-row (data/run-query checkins
(ql/aggregation (ql/min $count)))))
(expect-with-timeseries-dbs
[["1" 34.0071] ["2" 33.7701] ["3" 10.0646] ["4" 33.983]] ; some sort of weird quirk w/ druid where all columns in breakout get converted to strings
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment