Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: part of parser test migrated from duckdb #5125

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions tests/cases/standalone/common/parser/parser.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
-- columns aliases, from:
-- https://github.com/duckdb/duckdb/blob/9196dd9b0a163e6c8aada26218803d04be30c562/test/sql/parser/columns_aliases.test
CREATE TABLE integers (ts TIMESTAMP TIME INDEX, i INT, j INT);

Affected Rows: 0

INSERT INTO integers SELECT 0::TIMESTAMP ts, 42 i, 84 j UNION ALL SELECT 1::TIMESTAMP, 13, 14;

Affected Rows: 2

SELECT i, j FROM (SELECT COLUMNS(*)::VARCHAR FROM integers);

Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Invalid function 'columns'.
Did you mean 'COUNT'?

SELECT i, j FROM (SELECT * FROM integers);

+----+----+
| i | j |
+----+----+
| 42 | 84 |
| 13 | 14 |
+----+----+

SELECT min_i, min_j, max_i, max_j FROM (SELECT MIN(i) AS "min_i", MAX(i) AS "max_i", MIN(j) AS "min_j", MAX(j) AS "max_j" FROM integers);

+-------+-------+-------+-------+
| min_i | min_j | max_i | max_j |
+-------+-------+-------+-------+
| 13 | 14 | 42 | 84 |
+-------+-------+-------+-------+

DROP TABLE integers;

Affected Rows: 0

-- skipped, unsupported feature: digit separators
-- SELECT 1_000_000;
-- skipped, unsupported feature: division operator precedence
-- SELECT 6 + 1 // 2;
-- expression depth, from:
-- https://github.com/duckdb/duckdb/blob/9196dd9b0a163e6c8aada26218803d04be30c562/test/sql/parser/expression_depth_limit.test
SELECT (1+(1+(1+(1+(1+(1+(1+1)))))));

+---------------------------------------------------------------------------------------+
| Int64(1) + Int64(1) + Int64(1) + Int64(1) + Int64(1) + Int64(1) + Int64(1) + Int64(1) |
+---------------------------------------------------------------------------------------+
| 8 |
+---------------------------------------------------------------------------------------+

35 changes: 35 additions & 0 deletions tests/cases/standalone/common/parser/parser.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

-- columns aliases, from:
-- https://github.com/duckdb/duckdb/blob/9196dd9b0a163e6c8aada26218803d04be30c562/test/sql/parser/columns_aliases.test

CREATE TABLE integers (ts TIMESTAMP TIME INDEX, i INT, j INT);

INSERT INTO integers SELECT 0::TIMESTAMP ts, 42 i, 84 j UNION ALL SELECT 1::TIMESTAMP, 13, 14;

SELECT i, j FROM (SELECT COLUMNS(*)::VARCHAR FROM integers);

SELECT i, j FROM (SELECT * FROM integers);

SELECT min_i, min_j, max_i, max_j FROM (SELECT MIN(i) AS "min_i", MAX(i) AS "max_i", MIN(j) AS "min_j", MAX(j) AS "max_j" FROM integers);

DROP TABLE integers;

-- skipped, unsupported feature: digit separators
-- SELECT 1_000_000;

-- skipped, unsupported feature: division operator precedence
-- SELECT 6 + 1 // 2;

-- expression depth, from:
-- https://github.com/duckdb/duckdb/blob/9196dd9b0a163e6c8aada26218803d04be30c562/test/sql/parser/expression_depth_limit.test
SELECT (1+(1+(1+(1+(1+(1+(1+1)))))));

-- skipped, unsupported feature: dollar quotes
-- SELECT $$$$ = '';

-- skipped, unsupported feature: from_first, see also:
-- https://github.com/GreptimeTeam/greptimedb/issues/5012
-- FROM integers;

-- skipped, unsupported feature: function chaining
-- SELECT "abcd".upper().lower();
Loading