From 8a04ad572242a8e4a36759cbed9c9590030c40fa Mon Sep 17 00:00:00 2001
From: Michael Beer <michael@crate.io>
Date: Tue, 22 Nov 2016 17:22:48 +0100
Subject: [PATCH] removed between filter since this is released with Crate 0.57

---
 src/metabase/driver/crate.clj                 |  4 +--
 src/metabase/driver/crate/query_processor.clj | 31 -------------------
 2 files changed, 1 insertion(+), 34 deletions(-)
 delete mode 100644 src/metabase/driver/crate/query_processor.clj

diff --git a/src/metabase/driver/crate.clj b/src/metabase/driver/crate.clj
index 7ac916299b1..a189139104a 100644
--- a/src/metabase/driver/crate.clj
+++ b/src/metabase/driver/crate.clj
@@ -3,8 +3,7 @@
             [clojure.set :as set]
             [honeysql.core :as hsql]
             [metabase.driver :as driver]
-            (metabase.driver.crate [query-processor :as qp]
-                                   [util :as crate-util])
+            [metabase.driver.crate.util :as crate-util]
             [metabase.driver.generic-sql :as sql]
             [metabase.util :as u]))
 
@@ -77,7 +76,6 @@
          {:connection-details->spec  (u/drop-first-arg crate-spec)
           :column->base-type         (u/drop-first-arg column->base-type)
           :string-length-fn          (u/drop-first-arg string-length-fn)
-          :apply-filter              qp/apply-filter
           :date                      crate-util/date
           :unix-timestamp->timestamp crate-util/unix-timestamp->timestamp
           :current-datetime-fn       (constantly now)}))
diff --git a/src/metabase/driver/crate/query_processor.clj b/src/metabase/driver/crate/query_processor.clj
deleted file mode 100644
index 934141e7aaf..00000000000
--- a/src/metabase/driver/crate/query_processor.clj
+++ /dev/null
@@ -1,31 +0,0 @@
-(ns metabase.driver.crate.query-processor
-  (:require [honeysql.helpers :as h]
-            [metabase.driver.generic-sql.query-processor :as qp]
-            [metabase.query-processor.interface :as i]))
-
-(defn- rewrite-between
-  "Rewrite [:between <field> <min> <max>] -> [:and [:>= <field> <min>] [:<= <field> <max>]]"
-  [clause]
-  (i/strict-map->CompoundFilter {:compound-type :and
-                                 :subclauses    [(i/strict-map->ComparisonFilter {:filter-type :>=
-                                                                                  :field       (:field clause)
-                                                                                  :value       (:min-val clause)})
-                                                 (i/strict-map->ComparisonFilter {:filter-type :<=
-                                                                                  :field       (:field clause)
-                                                                                  :value       (:max-val clause)})]}))
-
-(defn- filter-clause->predicate
-  "resolve filters recursively"
-  [{:keys [compound-type filter-type subclause subclauses], :as clause}]
-  (case compound-type
-    :and (apply vector :and (map filter-clause->predicate subclauses))
-    :or  (apply vector :or  (map filter-clause->predicate subclauses))
-    :not [:not (filter-clause->predicate subclause)]
-    nil  (qp/filter-clause->predicate (if (= filter-type :between)
-                                        (rewrite-between clause)
-                                        clause))))
-
-(defn apply-filter
-  "Apply custom generic SQL filter. This is the place to perform query rewrites."
-  [_ honeysql-form {clause :filter}]
-  (h/where honeysql-form (filter-clause->predicate clause)))
-- 
GitLab