diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-22 18:53:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-22 18:53:34 +0000 |
commit | 8f88a01462641cbf930b3c43b780565d0fb7d37e (patch) | |
tree | e211588c29e6ce6d16fbbfd33d8cda63237c2e6e /tests/fixtures | |
parent | Releasing debian version 16.2.1-1. (diff) | |
download | sqlglot-8f88a01462641cbf930b3c43b780565d0fb7d37e.tar.xz sqlglot-8f88a01462641cbf930b3c43b780565d0fb7d37e.zip |
Merging upstream version 16.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/fixtures')
-rw-r--r-- | tests/fixtures/identity.sql | 2 | ||||
-rw-r--r-- | tests/fixtures/optimizer/optimizer.sql | 35 | ||||
-rw-r--r-- | tests/fixtures/optimizer/simplify.sql | 6 |
3 files changed, 41 insertions, 2 deletions
diff --git a/tests/fixtures/identity.sql b/tests/fixtures/identity.sql index e0ea9cb..ff3162b 100644 --- a/tests/fixtures/identity.sql +++ b/tests/fixtures/identity.sql @@ -519,8 +519,6 @@ SELECT student, score FROM tests CROSS JOIN UNNEST(scores) AS t(a, b) SELECT student, score FROM tests CROSS JOIN UNNEST(scores) WITH ORDINALITY AS t(a, b) SELECT student, score FROM tests CROSS JOIN UNNEST(x.scores) AS t(score) SELECT student, score FROM tests CROSS JOIN UNNEST(ARRAY(x.scores)) AS t(score) -SELECT * FROM t WITH (TABLOCK, INDEX(myindex)) -SELECT * FROM t WITH (NOWAIT) CREATE TABLE foo AS (SELECT 1) UNION ALL (SELECT 2) CREATE TABLE foo (id INT PRIMARY KEY ASC) CREATE TABLE a.b AS SELECT 1 diff --git a/tests/fixtures/optimizer/optimizer.sql b/tests/fixtures/optimizer/optimizer.sql index 0cb1a58..214535a 100644 --- a/tests/fixtures/optimizer/optimizer.sql +++ b/tests/fixtures/optimizer/optimizer.sql @@ -646,3 +646,38 @@ CROSS JOIN LATERAL ( "l"."log_date" DESC NULLS LAST LIMIT 1 ) AS "l"; + +# title: bigquery column identifiers are case-insensitive +# execute: false +# dialect: bigquery +WITH cte AS ( + SELECT + refresh_date AS `reFREsh_date`, + term AS `TeRm`, + `rank` + FROM `bigquery-public-data.GooGle_tReNDs.TOp_TeRmS` +) +SELECT + refresh_date AS `Day`, + term AS Top_Term, + rank, +FROM cte +WHERE + rank = 1 + AND refresh_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 2 WEEK) +GROUP BY `dAy`, `top_term`, rank +ORDER BY `DaY` DESC; +SELECT + `TOp_TeRmS`.`refresh_date` AS `day`, + `TOp_TeRmS`.`term` AS `top_term`, + `TOp_TeRmS`.`rank` AS `rank` +FROM `bigquery-public-data`.`GooGle_tReNDs`.`TOp_TeRmS` AS `TOp_TeRmS` +WHERE + `TOp_TeRmS`.`rank` = 1 + AND CAST(`TOp_TeRmS`.`refresh_date` AS DATE) >= DATE_SUB(CURRENT_DATE, INTERVAL 2 WEEK) +GROUP BY + `TOp_TeRmS`.`refresh_date`, + `TOp_TeRmS`.`term`, + `TOp_TeRmS`.`rank` +ORDER BY + `day` DESC; diff --git a/tests/fixtures/optimizer/simplify.sql b/tests/fixtures/optimizer/simplify.sql index 5c8d371..e0aded4 100644 --- a/tests/fixtures/optimizer/simplify.sql +++ b/tests/fixtures/optimizer/simplify.sql @@ -240,6 +240,12 @@ A AND B AND C; SELECT x WHERE TRUE; SELECT x; +SELECT x FROM y LEFT JOIN z ON TRUE; +SELECT x FROM y CROSS JOIN z; + +SELECT x FROM y JOIN z USING (x); +SELECT x FROM y JOIN z USING (x); + -------------------------------------- -- Parenthesis removal -------------------------------------- |