 (ns metabase.driver.generic-sql.query-processor-test
   (:require [clojure.math.numeric-tower :as math]
             [expectations :refer :all]
-            [metabase.driver.generic-sql.query-processor :refer :all]
+            [metabase.driver :as driver]
             [metabase.test-data :refer [db-id table->id field->id]]))
 
-(def venues-columns
-  (delay ["ID" "CATEGORY_ID" "PRICE" "LONGITUDE" "LATITUDE" "NAME"]))
+(def ^:const venues-columns
+  ["ID" "CATEGORY_ID" "PRICE" "LONGITUDE" "LATITUDE" "NAME"])
 
 (def venues-cols
   (delay [{:extra_info {} :special_type :id, :base_type :BigIntegerField, :description nil, :name "ID", :table_id (table->id :venues), :id (field->id :venues :id)}

     :row_count 2
     :data {:rows [[21 58 2 -122.421 37.7441 "PizzaHacker"]
                   [22 50 1 -122.484 37.7822 "Gordo Taqueria"]]
            :columns @venues-columns
            :cols @venues-cols}}
  (process-and-run {:type :query
                    :database @db-id
                    :query {:source_table (table->id :venues)
                            :filter ["BETWEEN" (field->id :venues :id) 21 22]
                            :aggregation ["rows"]
                            :breakout [nil]
                            :limit nil}}))

;; ### FILTER -- "OR", "<=", "="
(expect

     :row_count 2
     :data {:rows [[21 58 2 -122.421 37.7441 "PizzaHacker"]
                   [23 50 2 -122.42 37.765 "Taqueria Los Coyotes"]]
            :columns venues-columns
            :cols @venues-cols}}
  (driver/process-query {:type :query
                         :database @db-id
                         :query {:source_table (table->id :venues)
                                 :filter ["AND"
                                          ["<" (field->id :venues :id) 24]
                                          [">" (field->id :venues :id) 20]
                                          ["!=" (field->id :venues :id) 22]]
                                 :aggregation ["rows"]
                                 :breakout [nil]
                                 :limit nil}}))

;; ### FILTER -- "BETWEEN", single subclause (neither "AND" nor "OR")
(expect
