diff options
Diffstat (limited to 'tests/fixtures')
-rw-r--r-- | tests/fixtures/identity.sql | 12 | ||||
-rw-r--r-- | tests/fixtures/optimizer/qualify_columns.sql | 10 | ||||
-rw-r--r-- | tests/fixtures/optimizer/simplify.sql | 9 | ||||
-rw-r--r-- | tests/fixtures/pretty.sql | 28 |
4 files changed, 59 insertions, 0 deletions
diff --git a/tests/fixtures/identity.sql b/tests/fixtures/identity.sql index d7084ac..836ab28 100644 --- a/tests/fixtures/identity.sql +++ b/tests/fixtures/identity.sql @@ -523,6 +523,8 @@ DROP VIEW a.b DROP VIEW IF EXISTS a DROP VIEW IF EXISTS a.b SHOW TABLES +USE db +ROLLBACK EXPLAIN SELECT * FROM x INSERT INTO x SELECT * FROM y INSERT INTO x (SELECT * FROM y) @@ -569,3 +571,13 @@ SELECT * FROM (tbl1 LEFT JOIN tbl2 ON 1 = 1) SELECT * FROM (tbl1 JOIN tbl2 JOIN tbl3) SELECT * FROM (tbl1 JOIN (tbl2 JOIN tbl3) ON bla = foo) SELECT * FROM (tbl1 JOIN LATERAL (SELECT * FROM bla) AS tbl) +SELECT CAST(x AS INT) /* comment */ FROM foo +SELECT a /* x */, b /* x */ +SELECT * FROM foo /* x */, bla /* x */ +SELECT 1 /* comment */ + 1 +SELECT 1 /* c1 */ + 2 /* c2 */ +SELECT 1 /* c1 */ + 2 /* c2 */ + 3 /* c3 */ +SELECT 1 /* c1 */ + 2 /* c2 */, 3 /* c3 */ +SELECT x FROM a.b.c /* x */, e.f.g /* x */ +SELECT FOO(x /* c */) /* FOO */, b /* b */ +SELECT FOO(x /* c1 */ + y /* c2 */ + BLA(5 /* c3 */)) FROM VALUES (1 /* c4 */, "test" /* c5 */) /* c6 */ diff --git a/tests/fixtures/optimizer/qualify_columns.sql b/tests/fixtures/optimizer/qualify_columns.sql index a958c08..1176078 100644 --- a/tests/fixtures/optimizer/qualify_columns.sql +++ b/tests/fixtures/optimizer/qualify_columns.sql @@ -104,6 +104,16 @@ SELECT x.b AS b, x.a AS a FROM x AS x LEFT JOIN y AS y ON x.b = y.b QUALIFY ROW_ SELECT AGGREGATE(ARRAY(a, x.b), 0, (x, acc) -> x + acc + a) AS sum_agg FROM x; SELECT AGGREGATE(ARRAY(x.a, x.b), 0, (x, acc) -> x + acc + x.a) AS sum_agg FROM x AS x; +# dialect: starrocks +# execute: false +SELECT DATE_TRUNC('week', a) AS a FROM x; +SELECT DATE_TRUNC('week', x.a) AS a FROM x AS x; + +# dialect: bigquery +# execute: false +SELECT DATE_TRUNC(a, MONTH) AS a FROM x; +SELECT DATE_TRUNC(x.a, MONTH) AS a FROM x AS x; + -------------------------------------- -- Derived tables -------------------------------------- diff --git a/tests/fixtures/optimizer/simplify.sql b/tests/fixtures/optimizer/simplify.sql index 07e818f..7207ba2 100644 --- a/tests/fixtures/optimizer/simplify.sql +++ b/tests/fixtures/optimizer/simplify.sql @@ -79,6 +79,15 @@ NULL; NULL = NULL; NULL; +NULL <=> NULL; +TRUE; + +a IS NOT DISTINCT FROM a; +TRUE; + +NULL IS DISTINCT FROM NULL; +FALSE; + NOT (NOT TRUE); TRUE; diff --git a/tests/fixtures/pretty.sql b/tests/fixtures/pretty.sql index 2570650..5e27b5e 100644 --- a/tests/fixtures/pretty.sql +++ b/tests/fixtures/pretty.sql @@ -287,3 +287,31 @@ SELECT "fffffff" ) ); +/* + multi + line + comment +*/ +SELECT * FROM foo; +/* + multi + line + comment +*/ +SELECT + * +FROM foo; +SELECT x FROM a.b.c /*x*/, e.f.g /*x*/; +SELECT + x +FROM a.b.c /* x */, e.f.g /* x */; +SELECT x FROM (SELECT * FROM bla /*x*/WHERE id = 1) /*x*/; +SELECT + x +FROM ( + SELECT + * + FROM bla /* x */ + WHERE + id = 1 +) /* x */; |