Skip to content

Commit

Permalink
test(sql): regen snapshots for inner join key deduplication
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Feb 2, 2024
1 parent 72bd475 commit 401bcdc
Show file tree
Hide file tree
Showing 10 changed files with 287 additions and 141 deletions.
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"
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) - 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"."street",
ROW_NUMBER() OVER (ORDER BY "t0"."street" ASC) - 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"
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
), t1 AS (
`t5`.`street`,
ROW_NUMBER() OVER (ORDER BY `t5`.`street` ASC NULLS LAST) - 1 AS `key`
FROM (
SELECT
`t2`.`street`,
`t2`.`key`
FROM (
SELECT
`t0`.`street`,
ROW_NUMBER() OVER (ORDER BY `t0`.`street` ASC NULLS LAST) - 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 NULLS LAST) - 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 NULLS LAST) - 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`
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
WITH t0 AS (
WITH [t6] AS (
SELECT
t5.street AS street,
ROW_NUMBER() OVER (ORDER BY t5.street ASC) - 1 AS [key]
FROM data AS t5
), t1 AS (
[t5].[street] AS [street],
ROW_NUMBER() OVER (ORDER BY CASE WHEN [t5].[street] IS NULL THEN 1 ELSE 0 END, [t5].[street] ASC) - 1 AS [key]
FROM (
SELECT
[t2].[street] AS [street],
[t2].[key] AS [key]
FROM (
SELECT
[t0].[street] AS [street],
ROW_NUMBER() OVER (ORDER BY CASE WHEN [t0].[street] IS NULL THEN 1 ELSE 0 END, [t0].[street] ASC) - 1 AS [key]
FROM [data] AS [t0]
) AS [t2]
INNER JOIN (
SELECT
[t1].[key] AS [key]
FROM (
SELECT
[t0].[street] AS [street],
ROW_NUMBER() OVER (ORDER BY CASE WHEN [t0].[street] IS NULL THEN 1 ELSE 0 END, [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] AS [key]
FROM t0
), t2 AS (
SELECT
t0.street AS street,
t0.[key] AS [key]
FROM t0
JOIN t1
ON t0.[key] = t1.[key]
), t3 AS (
SELECT
t2.street AS street,
ROW_NUMBER() OVER (ORDER BY t2.street ASC) - 1 AS [key]
FROM t2
), t4 AS (
SELECT
t3.[key] AS [key]
FROM t3
[t0].[street] AS [street],
ROW_NUMBER() OVER (ORDER BY CASE WHEN [t0].[street] IS NULL THEN 1 ELSE 0 END, [t0].[street] ASC) - 1 AS [key]
FROM [data] AS [t0]
)
SELECT
t3.street,
t3.[key]
FROM t3
JOIN t4
ON t3.[key] = t4.[key]
[t8].[street],
[t8].[key]
FROM [t6] AS [t8]
INNER JOIN (
SELECT
[t7].[key] AS [key]
FROM [t6] AS [t7]
) AS [t10]
ON [t8].[key] = [t10].[key]
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
WITH t0 AS (
WITH "t6" AS (
SELECT
t5."street" AS "street",
ROW_NUMBER() OVER (ORDER BY t5."street" ASC) - 1 AS "key"
FROM "data" t5
), t1 AS (
"t5"."street",
ROW_NUMBER() OVER (ORDER BY "t5"."street" ASC NULLS LAST) - 1 AS "key"
FROM (
SELECT
"t2"."street",
"t2"."key"
FROM (
SELECT
"t0"."street",
ROW_NUMBER() OVER (ORDER BY "t0"."street" ASC NULLS LAST) - 1 AS "key"
FROM "data" "t0"
) "t2"
INNER JOIN (
SELECT
"t1"."key"
FROM (
SELECT
"t0"."street",
ROW_NUMBER() OVER (ORDER BY "t0"."street" ASC NULLS LAST) - 1 AS "key"
FROM "data" "t0"
) "t1"
) "t4"
ON "t2"."key" = "t4"."key"
) "t5"
), "t1" AS (
SELECT
t0."key" AS "key"
FROM t0
), t2 AS (
SELECT
t0."street" AS "street",
t0."key" AS "key"
FROM t0
JOIN t1
ON t0."key" = t1."key"
), t3 AS (
SELECT
t2."street" AS "street",
ROW_NUMBER() OVER (ORDER BY t2."street" ASC) - 1 AS "key"
FROM t2
), t4 AS (
SELECT
t3."key" AS "key"
FROM t3
"t0"."street",
ROW_NUMBER() OVER (ORDER BY "t0"."street" ASC NULLS LAST) - 1 AS "key"
FROM "data" "t0"
)
SELECT
t3."street",
t3."key"
FROM t3
JOIN t4
ON t3."key" = t4."key"
"t8"."street",
"t8"."key"
FROM "t6" "t8"
INNER JOIN (
SELECT
"t7"."key"
FROM "t6" "t7"
) "t10"
ON "t8"."key" = "t10"."key"
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
WITH "t1" AS (
SELECT
"t0"."key"
FROM "leaf" AS "t0"
WHERE
TRUE
)
SELECT
"t3"."key"
FROM "t1" AS "t3"
INNER JOIN "t1" AS "t4"
ON "t3"."key" = "t4"."key"
INNER JOIN (
SELECT
"t3"."key"
FROM "t1" AS "t3"
INNER JOIN "t1" AS "t4"
ON "t3"."key" = "t4"."key"
) AS "t6"
ON "t3"."key" = "t6"."key"
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
WITH "t1" AS (
SELECT
"t0"."key"
FROM "leaf" AS "t0"
WHERE
TRUE
)
SELECT
"t3"."key"
FROM "t1" AS "t3"
INNER JOIN "t1" AS "t4"
ON "t3"."key" = "t4"."key"
INNER JOIN (
SELECT
"t3"."key"
FROM "t1" AS "t3"
INNER JOIN "t1" AS "t4"
ON "t3"."key" = "t4"."key"
) AS "t6"
ON "t3"."key" = "t6"."key"
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
WITH t0 AS (
WITH `t1` AS (
SELECT
t4.*
FROM `leaf` AS t4
`t0`.`key`
FROM `leaf` AS `t0`
WHERE
TRUE
), t1 AS (
SELECT
t0.`key`
FROM t0
), t2 AS (
SELECT
t0.`key`
FROM t0
INNER JOIN t1
ON t0.`key` = t1.`key`
)
SELECT
t2.`key`
FROM t2
INNER JOIN t2 AS t3
ON t2.`key` = t3.`key`
`t3`.`key`
FROM `t1` AS `t3`
INNER JOIN `t1` AS `t4`
ON `t3`.`key` = `t4`.`key`
INNER JOIN (
SELECT
`t3`.`key`
FROM `t1` AS `t3`
INNER JOIN `t1` AS `t4`
ON `t3`.`key` = `t4`.`key`
) AS `t6`
ON `t3`.`key` = `t6`.`key`
Loading

0 comments on commit 401bcdc

Please sign in to comment.