diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-23 11:12:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-23 11:12:26 +0000 |
commit | 6ea73443a6a81d2477f8eab80dcf1a9206a44d5e (patch) | |
tree | b44112413472fb48b734e74cc01ac1082c197c4c /tests/fixtures | |
parent | Adding upstream version 25.5.1. (diff) | |
download | sqlglot-6ea73443a6a81d2477f8eab80dcf1a9206a44d5e.tar.xz sqlglot-6ea73443a6a81d2477f8eab80dcf1a9206a44d5e.zip |
Adding upstream version 25.6.1.upstream/25.6.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/fixtures')
-rw-r--r-- | tests/fixtures/identity.sql | 9 | ||||
-rw-r--r-- | tests/fixtures/optimizer/annotate_types.sql | 12 | ||||
-rw-r--r-- | tests/fixtures/optimizer/qualify_columns.sql | 30 | ||||
-rw-r--r-- | tests/fixtures/optimizer/qualify_tables.sql | 3 |
4 files changed, 43 insertions, 11 deletions
diff --git a/tests/fixtures/identity.sql b/tests/fixtures/identity.sql index 433c23d..5b1decd 100644 --- a/tests/fixtures/identity.sql +++ b/tests/fixtures/identity.sql @@ -53,6 +53,7 @@ x >> 1 | 1 & 1 ^ 1 x || y x[ : ] x[1 : ] +x[ : 2] x[1 : 2] x[-4 : -1] 1 - -1 @@ -777,14 +778,6 @@ ALTER TABLE table1 RENAME COLUMN IF EXISTS c1 TO c2 SELECT div.a FROM test_table AS div WITH view AS (SELECT 1 AS x) SELECT * FROM view ARRAY<STRUCT<INT, DOUBLE, ARRAY<INT>>> -ARRAY<INT>[1, 2, 3] -ARRAY<INT>[] -STRUCT<x VARCHAR(10)> -STRUCT<x VARCHAR(10)>("bla") -STRUCT<VARCHAR(10)>("bla") -STRUCT<INT>(5) -STRUCT<DATE>("2011-05-05") -STRUCT<x INT, y TEXT>(1, t.str_col) STRUCT<int INT> SELECT CAST(NULL AS ARRAY<INT>) IS NULL AS array_is_null ALTER TABLE "schema"."tablename" ADD CONSTRAINT "CHK_Name" CHECK (NOT "IdDwh" IS NULL AND "IdDwh" <> (0)) diff --git a/tests/fixtures/optimizer/annotate_types.sql b/tests/fixtures/optimizer/annotate_types.sql index e781765..589f0ec 100644 --- a/tests/fixtures/optimizer/annotate_types.sql +++ b/tests/fixtures/optimizer/annotate_types.sql @@ -55,3 +55,15 @@ STRUCT<a INT, b DOUBLE>; # dialect: presto ROW(1, 2.5, 'foo'); STRUCT<INT, DOUBLE, VARCHAR>; + +# dialect: bigquery +EXTRACT(date from x); +DATE; + +# dialect: bigquery +EXTRACT(time from x); +TIME; + +# dialect: bigquery +EXTRACT(day from x); +INT; diff --git a/tests/fixtures/optimizer/qualify_columns.sql b/tests/fixtures/optimizer/qualify_columns.sql index 836bcf2..444a8e0 100644 --- a/tests/fixtures/optimizer/qualify_columns.sql +++ b/tests/fixtures/optimizer/qualify_columns.sql @@ -385,14 +385,14 @@ WITH player AS (SELECT player.name, player.asset.info FROM players) SELECT * FRO WITH player AS (SELECT players.player.name AS name, players.player.asset.info AS info FROM players AS players) SELECT player.name AS name, player.info AS info FROM player AS player; -------------------------------------- --- Except and Replace +-- Except, Replace, Rename -------------------------------------- # execute: false -SELECT * REPLACE(a AS d) FROM x; +SELECT * RENAME(a AS d) FROM x; SELECT x.a AS d, x.b AS b FROM x AS x; # execute: false -SELECT * EXCEPT(b) REPLACE(a AS d) FROM x; +SELECT * EXCEPT(b) RENAME(a AS d) FROM x; SELECT x.a AS d FROM x AS x; SELECT x.* EXCEPT(a), y.* FROM x, y; @@ -416,6 +416,30 @@ SELECT x.a AS a, x.b AS b, y.b AS b FROM x AS x LEFT JOIN x AS y ON x.a = y.a; SELECT COALESCE(CAST(t1.a AS VARCHAR), '') AS a, t2.* EXCEPT (a) FROM x AS t1, x AS t2; SELECT COALESCE(CAST(t1.a AS VARCHAR), '') AS a, t2.b AS b FROM x AS t1, x AS t2; +# execute: false +SELECT * REPLACE(2 AS a) FROM x; +SELECT 2 AS a, x.b AS b FROM x AS x; + +# execute: false +SELECT * EXCEPT (a, b) REPLACE (a AS a) FROM x; +SELECT * EXCEPT (a, b) REPLACE (x.a AS a) FROM x AS x; + +# execute: false +SELECT * REPLACE(COALESCE(b, a) AS a, a as b) FROM x; +SELECT COALESCE(x.b, x.a) AS a, x.a AS b FROM x AS x; + +# execute: false +SELECT * REPLACE(1 AS a) RENAME(b as alias_b) FROM x; +SELECT 1 AS a, x.b AS alias_b FROM x AS x; + +# execute: false +SELECT * EXCEPT(a) REPLACE(COALESCE(a, b) AS b) RENAME(b AS new_b) FROM x; +SELECT COALESCE(x.a, x.b) AS new_b FROM x AS x; + +# execute: false +SELECT * REPLACE(1 AS a, a AS b) RENAME(b AS new_b) FROM x; +SELECT 1 AS a, x.a AS new_b FROM x AS x; + -------------------------------------- -- Using -------------------------------------- diff --git a/tests/fixtures/optimizer/qualify_tables.sql b/tests/fixtures/optimizer/qualify_tables.sql index 30bf834..4b7d33d 100644 --- a/tests/fixtures/optimizer/qualify_tables.sql +++ b/tests/fixtures/optimizer/qualify_tables.sql @@ -177,3 +177,6 @@ SELECT a.id, a_2.id FROM c.db1.a AS a JOIN c.db2.a AS a_2 ON a.id = a_2.id; SELECT cat.db1.a.id, db2.a.id FROM cat.db1.a JOIN db2.a ON cat.db1.a.id = db2.a.id; SELECT a.id, a_2.id FROM cat.db1.a AS a JOIN c.db2.a AS a_2 ON a.id = a_2.id; + +COPY INTO (SELECT * FROM x) TO 'data' WITH (FORMAT 'CSV'); +COPY INTO (SELECT * FROM c.db.x AS x) TO 'data' WITH (FORMAT 'CSV'); |