Skip to content
Snippets Groups Projects
Commit 6a421f53 authored by Cam Saul's avatar Cam Saul
Browse files

move more filter tests over

parent f9057a88
Branches
Tags
No related merge requests found
......@@ -201,9 +201,9 @@
(defclause :filter ["NOT_NULL" field-id]
{(field-id->kw field-id) {$exists true}})
(defclause :filter ["BETWEEN" field-id min max] ; is this supposed to be inclusive, or not ?
{(field-id->kw field-id) {$gt min
$lt max}})
(defclause :filter ["BETWEEN" field-id min max]
{(field-id->kw field-id) {$gte min
$lte max}})
(defclause :filter ["=" field-id value]
{(field-id->kw field-id) value})
......
......@@ -85,43 +85,6 @@
;; ## "FILTER" CLAUSE
;; ### FILTER -- "BETWEEN", single subclause (neither "AND" nor "OR")
(expect
{:status :completed
: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}}
(driver/process-query {: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
{:status :completed,
:row_count 4,
:data {:rows [[1 4 3 -165.374 10.0646 "Red Medicine"]
[2 11 2 -118.329 34.0996 "Stout Burgers & Beers"]
[3 11 2 -118.428 34.0406 "The Apple Pan"]
[5 20 2 -118.261 34.0778 "Brite Spot Family Restaurant"]]
:columns venues-columns
:cols @venues-cols}}
(driver/process-query {:type :query
:database @db-id
:query {:source_table (table->id :venues)
:filter ["OR"
["<=" (field->id :venues :id) 3]
["=" (field->id :venues :id) 5]]
:aggregation ["rows"]
:breakout [nil]
:limit nil}}))
;; TODO - These are working, but it would be nice to have some tests that covered
;; * NOT_NULL
;; * NULL
......
......@@ -388,3 +388,31 @@
:aggregation ["rows"]
:breakout [nil]
:limit nil})
;; ### FILTER -- "BETWEEN", single subclause (neither "AND" nor "OR")
(qp-expect-with-all-drivers
{:rows [[21 58 2 -122.421 37.7441 "PizzaHacker"]
[22 50 1 -122.484 37.7822 "Gordo Taqueria"]]
:columns (venues-columns)
:cols (venues-cols)}
{:source_table (->table-id :venues)
:filter ["BETWEEN" (->field-id :venues :id) 21 22]
:aggregation ["rows"]
:breakout [nil]
:limit nil})
;; ### FILTER -- "OR", "<=", "="
(qp-expect-with-all-drivers
{:rows [[1 4 3 -165.374 10.0646 "Red Medicine"]
[2 11 2 -118.329 34.0996 "Stout Burgers & Beers"]
[3 11 2 -118.428 34.0406 "The Apple Pan"]
[5 20 2 -118.261 34.0778 "Brite Spot Family Restaurant"]]
:columns (venues-columns)
:cols (venues-cols)}
{:source_table (->table-id :venues)
:filter ["OR"
["<=" (->field-id :venues :id) 3]
["=" (->field-id :venues :id) 5]]
:aggregation ["rows"]
:breakout [nil]
:limit nil})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment