Files
greptimedb/tests/cases/standalone/common/parser/operator_precedence.result
dennis zhuang 24e5c9f6da test: migrate duckdb tests, part 1 (#6870)
* test: migrate duckdb tests

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix: style

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* test: add more duckdb tests

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix: stable order

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* chore: simplfy comments

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* chore: remove tests/cases/standalone/common/DUCKDB_MIGRATION_GUIDE.md

* fix: incorrect_sql.sql

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix: integer flow test

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix: integer flow test

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* docs: add todo

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2025-09-05 06:10:14 +00:00

127 lines
3.3 KiB
Plaintext

-- Existing operator precedence tests
SELECT 2*3+1;
+--------------------------------+
| Int64(2) * Int64(3) + Int64(1) |
+--------------------------------+
| 7 |
+--------------------------------+
SELECT 1+2*3;
+--------------------------------+
| Int64(1) + Int64(2) * Int64(3) |
+--------------------------------+
| 7 |
+--------------------------------+
SELECT 2^2 + 1;
+--------------------------------------+
| Int64(2) BIT_XOR Int64(2) + Int64(1) |
+--------------------------------------+
| 1 |
+--------------------------------------+
SELECT 1+2^2;
+--------------------------------------+
| Int64(1) + Int64(2) BIT_XOR Int64(2) |
+--------------------------------------+
| 1 |
+--------------------------------------+
SELECT 2*4 / 2;
+--------------------------------+
| Int64(2) * Int64(4) / Int64(2) |
+--------------------------------+
| 4 |
+--------------------------------+
SELECT 2*(4 / 2);
+--------------------------------+
| Int64(2) * Int64(4) / Int64(2) |
+--------------------------------+
| 4 |
+--------------------------------+
SELECT 16/2*4;
+---------------------------------+
| Int64(16) / Int64(2) * Int64(4) |
+---------------------------------+
| 32 |
+---------------------------------+
SELECT (16/2)*4;
+---------------------------------+
| Int64(16) / Int64(2) * Int64(4) |
+---------------------------------+
| 32 |
+---------------------------------+
SELECT 2*3*2;
+--------------------------------+
| Int64(2) * Int64(3) * Int64(2) |
+--------------------------------+
| 12 |
+--------------------------------+
SELECT 2^3*2;
+--------------------------------------+
| Int64(2) BIT_XOR Int64(3) * Int64(2) |
+--------------------------------------+
| 4 |
+--------------------------------------+
SELECT 2*3^2;
+--------------------------------------+
| Int64(2) * Int64(3) BIT_XOR Int64(2) |
+--------------------------------------+
| 4 |
+--------------------------------------+
-- Migrated from DuckDB test: test/sql/parser/division_operator_precedence.test
-- Additional division operator precedence tests (only standard division)
-- Division operator precedence
SELECT 6 * 1 / 2;
+--------------------------------+
| Int64(6) * Int64(1) / Int64(2) |
+--------------------------------+
| 3 |
+--------------------------------+
-- Addition and division precedence
SELECT 6 + 1 / 2;
+--------------------------------+
| Int64(6) + Int64(1) / Int64(2) |
+--------------------------------+
| 6 |
+--------------------------------+
-- More division precedence tests
SELECT 10 / 2 * 3;
+---------------------------------+
| Int64(10) / Int64(2) * Int64(3) |
+---------------------------------+
| 15 |
+---------------------------------+
SELECT 10 / (2 * 3);
+---------------------------------+
| Int64(10) / Int64(2) * Int64(3) |
+---------------------------------+
| 1 |
+---------------------------------+