diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn index 3ba457a..c825858 100644 --- a/.clj-kondo/config.edn +++ b/.clj-kondo/config.edn @@ -14,6 +14,10 @@ clojure.core/prn {:message "Use clojure.tools.logging instead."} clojure.pprint/pprint {:message "Use clojure.tools.logging instead."}} + :unresolved-symbol + {:exclude + [(clojure.test/is [=? malli=])]} + :refer {:level :warning :exclude [clojure.test diff --git a/test/macaw/core_test.clj b/test/macaw/core_test.clj index ec46693..7cc7619 100644 --- a/test/macaw/core_test.clj +++ b/test/macaw/core_test.clj @@ -7,7 +7,7 @@ [macaw.core :as m] [macaw.test.util :refer [ws=]] [macaw.walk :as mw] - [mb.hawk.assert-exprs.approximately-equal]) + [mb.hawk.assert-exprs]) (:import (clojure.lang ExceptionInfo) (net.sf.jsqlparser.schema Table))) @@ -355,8 +355,6 @@ from foo") (is (= #{{:table "foo"}} (table-wcs "SELECT f.* FROM orders o JOIN foo f ON orders.id = foo.order_id")))) -;; TODO Fix kondo linting of =? (strangely enough I don't need this locally) -^:clj-kondo/ignore (deftest context-test (testing "Sub-select with outer wildcard" ;; TODO we should test the source and result columns too diff --git a/test/resources/acceptance/compound__subselect_table_masking.analysis.edn b/test/resources/acceptance/compound__subselect_table_masking.analysis.edn new file mode 100644 index 0000000..7f80e62 --- /dev/null +++ b/test/resources/acceptance/compound__subselect_table_masking.analysis.edn @@ -0,0 +1,23 @@ +{:tables #{{:table "addresses"} + {:table "customers"} + {:table "orders"}} + :source-columns #{{:table "addresses" :column "country"} + {:table "addresses" :column "organization_id"} + {:table "addresses" :column "region"} + {:table "customers" :column "country"} + {:table "customers" :column "id"} + {:table "customers" :column "state"} + {:table "orders" :column "customer_id"} + {:table "orders" :column "organization_id"}} + + ;; In the same general category as https://github.com/metabase/metabase/issues/42586 + :overrides + {:source-columns #{{:table "addresses" :column "country"} + {:table "addresses" :column "organization_id"} + {:table "addresses" :column "region"} + {:table "addresses" :column "state"} ;; This one is spurious + {:table "customers" :column "country"} + {:table "customers" :column "id"} + {:table "customers" :column "state"} + {:table "orders" :column "customer_id"} + {:table "orders" :column "organization_id"}}}} diff --git a/test/resources/acceptance/compound__subselect_table_masking.sql b/test/resources/acceptance/compound__subselect_table_masking.sql new file mode 100644 index 0000000..5920fea --- /dev/null +++ b/test/resources/acceptance/compound__subselect_table_masking.sql @@ -0,0 +1,10 @@ +SELECT +CASE WHEN Addr.country = 'US' THEN Addr.state ELSE 'ex-US' END AS state +FROM ( + SELECT DISTINCT + coalesce(Cust.state, Addr.region) AS state, + coalesce(Cust.country, Addr.country) AS country + FROM orders + LEFT JOIN addresses AS Addr ON orders.organization_id = Addr.organization_id + LEFT JOIN customers AS Cust ON orders.customer_id = Cust.id +) AS Addr