-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): support the inner join convenience to not repeat fields kn…
…own to be equal (#8127) Co-authored-by: Phillip Cloud <[email protected]>
- Loading branch information
Showing
37 changed files
with
1,058 additions
and
762 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
68 changes: 37 additions & 31 deletions
68
ibis/backends/tests/snapshots/test_generic/test_many_subqueries/bigquery/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,36 +1,42 @@ | ||
WITH t0 AS ( | ||
WITH t6 AS ( | ||
SELECT | ||
t5.*, | ||
( | ||
row_number() OVER (ORDER BY t5.`street` ASC) - 1 | ||
) AS `key` | ||
FROM data AS t5 | ||
t5.street, | ||
ROW_NUMBER() OVER (ORDER BY t5.street ASC) - 1 AS key | ||
FROM ( | ||
SELECT | ||
t2.street, | ||
t2.key | ||
FROM ( | ||
SELECT | ||
t0.street, | ||
ROW_NUMBER() OVER (ORDER BY t0.street ASC) - 1 AS key | ||
FROM data AS t0 | ||
) AS t2 | ||
INNER JOIN ( | ||
SELECT | ||
t1.key | ||
FROM ( | ||
SELECT | ||
t0.street, | ||
ROW_NUMBER() OVER (ORDER BY t0.street ASC) - 1 AS key | ||
FROM data AS t0 | ||
) AS t1 | ||
) AS t4 | ||
ON t2.key = t4.key | ||
) AS t5 | ||
), t1 AS ( | ||
SELECT | ||
t0.`key` | ||
FROM t0 | ||
), t2 AS ( | ||
SELECT | ||
t0.`street`, | ||
t0.`key` | ||
FROM t0 | ||
INNER JOIN t1 | ||
ON t0.`key` = t1.`key` | ||
), t3 AS ( | ||
SELECT | ||
t2.`street`, | ||
( | ||
row_number() OVER (ORDER BY t2.`street` ASC) - 1 | ||
) AS `key` | ||
FROM t2 | ||
), t4 AS ( | ||
SELECT | ||
t3.`key` | ||
FROM t3 | ||
t0.street, | ||
ROW_NUMBER() OVER (ORDER BY t0.street ASC) - 1 AS key | ||
FROM data AS t0 | ||
) | ||
SELECT | ||
t3.`street`, | ||
t3.`key` | ||
FROM t3 | ||
INNER JOIN t4 | ||
ON t3.`key` = t4.`key` | ||
t8.street, | ||
t8.key | ||
FROM t6 AS t8 | ||
INNER JOIN ( | ||
SELECT | ||
t7.key | ||
FROM t6 AS t7 | ||
) AS t10 | ||
ON t8.key = t10.key |
67 changes: 27 additions & 40 deletions
67
ibis/backends/tests/snapshots/test_generic/test_many_subqueries/clickhouse/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,55 +1,42 @@ | ||
SELECT | ||
t5.street AS street, | ||
t5.key AS key, | ||
t5.key_right AS key_right | ||
FROM ( | ||
SELECT | ||
t1.street AS street, | ||
ROW_NUMBER() OVER (ORDER BY t1.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS key, | ||
t3.key AS key_right | ||
FROM ( | ||
SELECT | ||
t0.street AS street, | ||
ROW_NUMBER() OVER (ORDER BY t0.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS key | ||
FROM data AS t0 | ||
) AS t1 | ||
INNER JOIN ( | ||
SELECT | ||
t1.key AS key | ||
FROM ( | ||
SELECT | ||
t0.street AS street, | ||
ROW_NUMBER() OVER (ORDER BY t0.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS key | ||
FROM data AS t0 | ||
) AS t1 | ||
) AS t3 | ||
ON t1.key = t3.key | ||
) AS t5 | ||
INNER JOIN ( | ||
WITH t6 AS ( | ||
SELECT | ||
t5.key AS key | ||
t5.street, | ||
ROW_NUMBER() OVER (ORDER BY t5.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS key | ||
FROM ( | ||
SELECT | ||
t1.street AS street, | ||
ROW_NUMBER() OVER (ORDER BY t1.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS key, | ||
t3.key AS key_right | ||
t2.street, | ||
t2.key | ||
FROM ( | ||
SELECT | ||
t0.street AS street, | ||
t0.street, | ||
ROW_NUMBER() OVER (ORDER BY t0.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS key | ||
FROM data AS t0 | ||
) AS t1 | ||
) AS t2 | ||
INNER JOIN ( | ||
SELECT | ||
t1.key AS key | ||
t1.key | ||
FROM ( | ||
SELECT | ||
t0.street AS street, | ||
t0.street, | ||
ROW_NUMBER() OVER (ORDER BY t0.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS key | ||
FROM data AS t0 | ||
) AS t1 | ||
) AS t3 | ||
ON t1.key = t3.key | ||
) AS t4 | ||
ON t2.key = t4.key | ||
) AS t5 | ||
) AS t7 | ||
ON t5.key = t7.key | ||
), t1 AS ( | ||
SELECT | ||
t0.street, | ||
ROW_NUMBER() OVER (ORDER BY t0.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS key | ||
FROM data AS t0 | ||
) | ||
SELECT | ||
t8.street, | ||
t8.key | ||
FROM t6 AS t8 | ||
INNER JOIN ( | ||
SELECT | ||
t7.key | ||
FROM t6 AS t7 | ||
) AS t10 | ||
ON t8.key = t10.key |
67 changes: 27 additions & 40 deletions
67
ibis/backends/tests/snapshots/test_generic/test_many_subqueries/datafusion/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,55 +1,42 @@ | ||
SELECT | ||
"t5"."street" AS "street", | ||
"t5"."key" AS "key", | ||
"t5"."key_right" AS "key_right" | ||
FROM ( | ||
SELECT | ||
"t1"."street" AS "street", | ||
ROW_NUMBER() OVER (ORDER BY "t1"."street" ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS "key", | ||
"t2"."key" AS "key_right" | ||
FROM ( | ||
SELECT | ||
"t0"."street" AS "street", | ||
ROW_NUMBER() OVER (ORDER BY "t0"."street" ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS "key" | ||
FROM "data" AS "t0" | ||
) AS "t1" | ||
INNER JOIN ( | ||
SELECT | ||
"t1"."key" AS "key" | ||
FROM ( | ||
SELECT | ||
"t0"."street" AS "street", | ||
ROW_NUMBER() OVER (ORDER BY "t0"."street" ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS "key" | ||
FROM "data" AS "t0" | ||
) AS "t1" | ||
) AS "t2" | ||
ON "t1"."key" = "t2"."key" | ||
) AS "t5" | ||
INNER JOIN ( | ||
WITH "t6" AS ( | ||
SELECT | ||
"t5"."key" AS "key" | ||
"t5"."street", | ||
ROW_NUMBER() OVER (ORDER BY "t5"."street" ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS "key" | ||
FROM ( | ||
SELECT | ||
"t1"."street" AS "street", | ||
ROW_NUMBER() OVER (ORDER BY "t1"."street" ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS "key", | ||
"t2"."key" AS "key_right" | ||
"t2"."street", | ||
"t2"."key" | ||
FROM ( | ||
SELECT | ||
"t0"."street" AS "street", | ||
"t0"."street", | ||
ROW_NUMBER() OVER (ORDER BY "t0"."street" ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS "key" | ||
FROM "data" AS "t0" | ||
) AS "t1" | ||
) AS "t2" | ||
INNER JOIN ( | ||
SELECT | ||
"t1"."key" AS "key" | ||
"t1"."key" | ||
FROM ( | ||
SELECT | ||
"t0"."street" AS "street", | ||
"t0"."street", | ||
ROW_NUMBER() OVER (ORDER BY "t0"."street" ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS "key" | ||
FROM "data" AS "t0" | ||
) AS "t1" | ||
) AS "t2" | ||
ON "t1"."key" = "t2"."key" | ||
) AS "t4" | ||
ON "t2"."key" = "t4"."key" | ||
) AS "t5" | ||
) AS "t6" | ||
ON "t5"."key" = "t6"."key" | ||
), "t1" AS ( | ||
SELECT | ||
"t0"."street", | ||
ROW_NUMBER() OVER (ORDER BY "t0"."street" ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS "key" | ||
FROM "data" AS "t0" | ||
) | ||
SELECT | ||
"t8"."street", | ||
"t8"."key" | ||
FROM "t6" AS "t8" | ||
INNER JOIN ( | ||
SELECT | ||
"t7"."key" | ||
FROM "t6" AS "t7" | ||
) AS "t10" | ||
ON "t8"."key" = "t10"."key" |
42 changes: 42 additions & 0 deletions
42
ibis/backends/tests/snapshots/test_generic/test_many_subqueries/druid/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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
WITH "t6" AS ( | ||
SELECT | ||
"t5"."street", | ||
ROW_NUMBER() OVER (ORDER BY "t5"."street" ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS "key" | ||
FROM ( | ||
SELECT | ||
"t2"."street", | ||
"t2"."key" | ||
FROM ( | ||
SELECT | ||
"t0"."street", | ||
ROW_NUMBER() OVER (ORDER BY "t0"."street" ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS "key" | ||
FROM "data" AS "t0" | ||
) AS "t2" | ||
INNER JOIN ( | ||
SELECT | ||
"t1"."key" | ||
FROM ( | ||
SELECT | ||
"t0"."street", | ||
ROW_NUMBER() OVER (ORDER BY "t0"."street" ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS "key" | ||
FROM "data" AS "t0" | ||
) AS "t1" | ||
) AS "t4" | ||
ON "t2"."key" = "t4"."key" | ||
) AS "t5" | ||
), "t1" AS ( | ||
SELECT | ||
"t0"."street", | ||
ROW_NUMBER() OVER (ORDER BY "t0"."street" ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS "key" | ||
FROM "data" AS "t0" | ||
) | ||
SELECT | ||
"t8"."street", | ||
"t8"."key" | ||
FROM "t6" AS "t8" | ||
INNER JOIN ( | ||
SELECT | ||
"t7"."key" | ||
FROM "t6" AS "t7" | ||
) AS "t10" | ||
ON "t8"."key" = "t10"."key" |
67 changes: 27 additions & 40 deletions
67
ibis/backends/tests/snapshots/test_generic/test_many_subqueries/duckdb/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,55 +1,42 @@ | ||
SELECT | ||
t5.street AS street, | ||
t5.key AS key, | ||
t5.key_right AS key_right | ||
FROM ( | ||
SELECT | ||
t1.street AS street, | ||
ROW_NUMBER() OVER (ORDER BY t1.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - CAST(1 AS TINYINT) AS key, | ||
t3.key AS key_right | ||
FROM ( | ||
SELECT | ||
t0.street AS street, | ||
ROW_NUMBER() OVER (ORDER BY t0.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - CAST(1 AS TINYINT) AS key | ||
FROM data AS t0 | ||
) AS t1 | ||
INNER JOIN ( | ||
SELECT | ||
t1.key AS key | ||
FROM ( | ||
SELECT | ||
t0.street AS street, | ||
ROW_NUMBER() OVER (ORDER BY t0.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - CAST(1 AS TINYINT) AS key | ||
FROM data AS t0 | ||
) AS t1 | ||
) AS t3 | ||
ON t1.key = t3.key | ||
) AS t5 | ||
INNER JOIN ( | ||
WITH t6 AS ( | ||
SELECT | ||
t5.key AS key | ||
t5.street, | ||
ROW_NUMBER() OVER (ORDER BY t5.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - CAST(1 AS TINYINT) AS key | ||
FROM ( | ||
SELECT | ||
t1.street AS street, | ||
ROW_NUMBER() OVER (ORDER BY t1.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - CAST(1 AS TINYINT) AS key, | ||
t3.key AS key_right | ||
t2.street, | ||
t2.key | ||
FROM ( | ||
SELECT | ||
t0.street AS street, | ||
t0.street, | ||
ROW_NUMBER() OVER (ORDER BY t0.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - CAST(1 AS TINYINT) AS key | ||
FROM data AS t0 | ||
) AS t1 | ||
) AS t2 | ||
INNER JOIN ( | ||
SELECT | ||
t1.key AS key | ||
t1.key | ||
FROM ( | ||
SELECT | ||
t0.street AS street, | ||
t0.street, | ||
ROW_NUMBER() OVER (ORDER BY t0.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - CAST(1 AS TINYINT) AS key | ||
FROM data AS t0 | ||
) AS t1 | ||
) AS t3 | ||
ON t1.key = t3.key | ||
) AS t4 | ||
ON t2.key = t4.key | ||
) AS t5 | ||
) AS t7 | ||
ON t5.key = t7.key | ||
), t1 AS ( | ||
SELECT | ||
t0.street, | ||
ROW_NUMBER() OVER (ORDER BY t0.street ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - CAST(1 AS TINYINT) AS key | ||
FROM data AS t0 | ||
) | ||
SELECT | ||
t8.street, | ||
t8.key | ||
FROM t6 AS t8 | ||
INNER JOIN ( | ||
SELECT | ||
t7.key | ||
FROM t6 AS t7 | ||
) AS t10 | ||
ON t8.key = t10.key |
Oops, something went wrong.