Skip to content

Commit

Permalink
fix count-where, share tests (ClickHouse#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
enqueue authored Jun 15, 2019
1 parent 10ed9d5 commit 37fe1a9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/metabase/driver/clickhouse.clj
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,19 @@
(hsql/call :toFloat64 (sql.qp/->honeysql driver arg)))]
((get-method sql.qp/->honeysql [:sql :/]) driver args)))

;; I do not know why the tests expect nil counts for empty results
;; but that's how it is :-)
;; metabase.query-processor-test.count-where-test
;; metabase.query-processor-test.share-test
(defmethod sql.qp/->honeysql [:clickhouse :count-where]
[driver [_ pred]]
(hsql/call :case
(hsql/call :> (hsql/call :count) 0)
(hsql/call :sum (hsql/call :case
(sql.qp/->honeysql driver pred) 1.0
:else 0.0))
:else nil))

(defmethod sql.qp/quote-style :clickhouse [_] :mysql)


Expand Down

0 comments on commit 37fe1a9

Please sign in to comment.