-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for subquery name clash bug (#98)
* Add test for subquery clashes * Fix =? handling * Little cleanups
- Loading branch information
1 parent
ba695c5
commit bc2b663
Showing
4 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
test/resources/acceptance/compound__subselect_table_masking.analysis.edn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"}}}} |
10 changes: 10 additions & 0 deletions
10
test/resources/acceptance/compound__subselect_table_masking.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |