diff options
Diffstat (limited to 'tests/fixtures/optimizer/optimizer.sql')
-rw-r--r-- | tests/fixtures/optimizer/optimizer.sql | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/tests/fixtures/optimizer/optimizer.sql b/tests/fixtures/optimizer/optimizer.sql index f81d54a..4ae9e90 100644 --- a/tests/fixtures/optimizer/optimizer.sql +++ b/tests/fixtures/optimizer/optimizer.sql @@ -131,7 +131,7 @@ SELECT SUM("y"."b") AS "sum_b" FROM "x" AS "x" LEFT JOIN "_u_0" AS "_u_0" - ON "x"."b" = "_u_0"."_u_1" + ON "_u_0"."_u_1" = "x"."b" JOIN "y" AS "y" ON "x"."b" = "y"."b" WHERE @@ -522,7 +522,7 @@ OR ( SELECT *, IFF( - IFF("unioned"."uploaded_at" >= '2022-06-16', 'workday', 'bamboohr') = "unioned"."source_system", + "unioned"."source_system" = IFF("unioned"."uploaded_at" >= '2022-06-16', 'workday', 'bamboohr'), 1, 0 ) AS "sort_order" @@ -950,7 +950,7 @@ SELECT FROM "y" AS "y" CROSS JOIN "_u_0" AS "_u_0" JOIN "x" AS "x" - ON "y"."b" = "x"."b" + ON "x"."b" = "y"."b" GROUP BY "x"."a"; @@ -989,7 +989,7 @@ SELECT COALESCE("m"."a", "foo"."a") AS "a" FROM "m" JOIN "n" AS "foo"("a") - ON "m"."a" = "foo"."a"; + ON "foo"."a" = "m"."a"; # title: reduction of string concatenation that uses CONCAT(..), || and + # execute: false @@ -1068,7 +1068,7 @@ SELECT COALESCE("alias3"."c_od", 0) AS "c_od" FROM "table1" AS "table1" LEFT JOIN "alias3" - ON "table1"."cid" = "alias3"."cid"; + ON "alias3"."cid" = "table1"."cid"; # title: CTE with EXPLODE cannot be merged # dialect: spark @@ -1115,3 +1115,32 @@ WITH `t` AS ( SELECT `t`.`CoL` AS `CoL` FROM `t`; + +# title: top-level query is parenthesized +# execute: false +WITH x AS ( + SELECT a FROM t +) +( + SELECT * FROM x + UNION ALL + SELECT * FROM x + LIMIT 10 +) +LIMIT 10; +WITH "x" AS ( + SELECT + "t"."a" AS "a" + FROM "t" AS "t" +) +( + SELECT + "x"."a" AS "a" + FROM "x" + UNION ALL + SELECT + "x"."a" AS "a" + FROM "x" + LIMIT 10 +) +LIMIT 10; |