-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
75 additions
and
44 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
35 changes: 16 additions & 19 deletions
35
ibis/backends/impala/tests/snapshots/test_sql/test_nested_join_multiple_ctes/out.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 |
---|---|---|
@@ -1,32 +1,29 @@ | ||
WITH t0 AS ( | ||
SELECT t3.`userid`, t3.`movieid`, t3.`rating`, | ||
CAST(t3.`timestamp` AS timestamp) AS `datetime` | ||
FROM ratings t3 | ||
SELECT t2.`userid`, t2.`movieid`, t2.`rating`, | ||
CAST(t2.`timestamp` AS timestamp) AS `datetime` | ||
FROM ratings t2 | ||
), | ||
t1 AS ( | ||
SELECT t0.*, t4.`title` | ||
SELECT t0.*, t3.`title` | ||
FROM t0 | ||
INNER JOIN movies t4 | ||
ON t0.`movieid` = t4.`movieid` | ||
INNER JOIN movies t3 | ||
ON t0.`movieid` = t3.`movieid` | ||
) | ||
SELECT t2.* | ||
FROM ( | ||
SELECT t1.* | ||
FROM t1 | ||
WHERE (t1.`userid` = 118205) AND | ||
(extract(t1.`datetime`, 'year') > 2001) | ||
) t2 | ||
WHERE t2.`movieid` IN ( | ||
SELECT t3.`movieid` | ||
SELECT t1.* | ||
FROM t1 | ||
WHERE (t1.`userid` = 118205) AND | ||
(extract(t1.`datetime`, 'year') > 2001) AND | ||
(t1.`movieid` IN ( | ||
SELECT t2.`movieid` | ||
FROM ( | ||
SELECT t4.`movieid` | ||
SELECT t3.`movieid` | ||
FROM ( | ||
SELECT t1.* | ||
FROM t1 | ||
WHERE (t1.`userid` = 118205) AND | ||
(extract(t1.`datetime`, 'year') > 2001) AND | ||
(t1.`userid` = 118205) AND | ||
(extract(t1.`datetime`, 'year') < 2009) | ||
) t4 | ||
) t3 | ||
) | ||
) t3 | ||
) t2 | ||
)) |
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