-
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.
Fix phantom fields for boolean literals (#84)
- Loading branch information
1 parent
3b0d3ed
commit 1c4ea0b
Showing
14 changed files
with
50 additions
and
2 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
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
10 changes: 10 additions & 0 deletions
10
test/resources/acceptance/compound__cte_deadscope.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,10 @@ | ||
;; If we decide to perform "dead scope" elimination, t1 would not be listed as a source either. | ||
{:tables [{:table "t1"} {:table "t2"}] | ||
:source-columns [{:table "t2", :column "x"} ;; from cte | ||
{:table "t2", :column "y"}] ;; from outer select | ||
|
||
;; See https://github.com/metabase/metabase/issues/42586 | ||
:overrides | ||
;; We are not taking into account the t1 (via cte) is not in-scope in the top-level SELECT. | ||
{:source-columns [{:column "x"} | ||
{:column "y"}]}} |
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,4 @@ | ||
WITH cte AS ( | ||
SELECT x FROM t1 | ||
) | ||
SELECT x, y FROM t2 |
12 changes: 12 additions & 0 deletions
12
test/resources/acceptance/compound__cte_nonambiguous.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,12 @@ | ||
{:tables [{:table "t1"} {:table "t2"}] | ||
:source-columns [{:table "t1", :column "x"} ;; from cte | ||
{:table "t2", :column "y"}] ;; from outer select | ||
|
||
;; See https://github.com/metabase/metabase/issues/42586 | ||
:overrides | ||
;; We are not taking into account that x is introduced with only t1 in scope. | ||
;; We are not taking into account that x must not be an ambiguous reference in | ||
;; the top-level query. | ||
{:source-columns [{:column "x"} | ||
;; We are not excluding the CTE, whose outputs are known, as a source for y. | ||
{:column "y"}]}} |
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,4 @@ | ||
WITH cte AS ( | ||
SELECT x FROM t1 | ||
) | ||
SELECT x, y FROM t2 JOIN cte |
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
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,2 @@ | ||
{:tables [{:table "t"}] | ||
:source-columns [{:table "t", :column "x"}]} |
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 @@ | ||
SELECT FALSE, 'str', 1, x FROM t |
2 changes: 2 additions & 0 deletions
2
test/resources/acceptance/literal__without_table.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,2 @@ | ||
{:tables [] | ||
:source-columns []} |
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 @@ | ||
SELECT FALSE, 'str', 1 |
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