Skip to content

Commit

Permalink
Track another issue with compound queries (#85)
Browse files Browse the repository at this point in the history
* Surprising fail

* Fix query
  • Loading branch information
crisptrutski authored Aug 16, 2024
1 parent 1c4ea0b commit 1ee2fe2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/macaw/acceptance_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,15 @@
(doseq [[ck cv] (dissoc expected-cs :overrides)]
(testing (str prefix " analysis is correct: " (name ck))
(let [actual-cv (get-component cs ck)
expected (get-in expected-cs [:overrides ck] cv)]
(if (vector? cv)
override (get-in expected-cs [:overrides ck])
expected (or override cv)]

(when override
(if (vector? cv)
(is (not= cv (ct/sorted actual-cv)) "Override is still needed")
(is (not= cv actual-cv) "Override is still needed")))

(if (vector? expected)
(is (= expected (ct/sorted actual-cv)))
(is (= expected actual-cv))))))))
(when renames
Expand Down
8 changes: 8 additions & 0 deletions test/resources/acceptance/compound__cte_simple.analysis.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{:tables [{:table "t1"} {:table "t2"}]
:source-columns [{:table "t1", :column "x"}
{:table "t2", :column "y"}]

:overrides
;; Missing x completely!
;; See https://github.com/metabase/metabase/issues/42586
{:source-columns [{:column "y"}]}}
1 change: 1 addition & 0 deletions test/resources/acceptance/compound__cte_simple.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WITH cte AS (SELECT x FROM t1) SELECT cte.x, y FROM t2 JOIN cte;

0 comments on commit 1ee2fe2

Please sign in to comment.