mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-09 06:42:57 +00:00
* 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>
75 lines
2.8 KiB
Plaintext
75 lines
2.8 KiB
Plaintext
-- Migrated from DuckDB test: test/sql/join/test_complex_join_expr.test
|
|
CREATE TABLE test (a INTEGER, b INTEGER, ts TIMESTAMP TIME INDEX);
|
|
|
|
Affected Rows: 0
|
|
|
|
INSERT INTO test VALUES (4, 1, 1000), (2, 2, 2000);
|
|
|
|
Affected Rows: 2
|
|
|
|
CREATE TABLE test2 (b INTEGER, c INTEGER, ts TIMESTAMP TIME INDEX);
|
|
|
|
Affected Rows: 0
|
|
|
|
INSERT INTO test2 VALUES (1, 2, 3000), (3, 0, 4000);
|
|
|
|
Affected Rows: 2
|
|
|
|
-- INNER JOIN with complex expression
|
|
SELECT * FROM test JOIN test2 ON test.a+test2.c=test.b+test2.b ORDER BY test.a;
|
|
|
|
+---+---+---------------------+---+---+---------------------+
|
|
| a | b | ts | b | c | ts |
|
|
+---+---+---------------------+---+---+---------------------+
|
|
| 4 | 1 | 1970-01-01T00:00:01 | 3 | 0 | 1970-01-01T00:00:04 |
|
|
+---+---+---------------------+---+---+---------------------+
|
|
|
|
-- LEFT JOIN with complex expression
|
|
SELECT * FROM test LEFT JOIN test2 ON test.a+test2.c=test.b+test2.b ORDER BY test.a;
|
|
|
|
+---+---+---------------------+---+---+---------------------+
|
|
| a | b | ts | b | c | ts |
|
|
+---+---+---------------------+---+---+---------------------+
|
|
| 2 | 2 | 1970-01-01T00:00:02 | | | |
|
|
| 4 | 1 | 1970-01-01T00:00:01 | 3 | 0 | 1970-01-01T00:00:04 |
|
|
+---+---+---------------------+---+---+---------------------+
|
|
|
|
-- RIGHT JOIN with complex expression
|
|
SELECT * FROM test RIGHT JOIN test2 ON test.a+test2.c=test.b+test2.b ORDER BY test.a NULLS FIRST;
|
|
|
|
+---+---+---------------------+---+---+---------------------+
|
|
| a | b | ts | b | c | ts |
|
|
+---+---+---------------------+---+---+---------------------+
|
|
| | | | 1 | 2 | 1970-01-01T00:00:03 |
|
|
| 4 | 1 | 1970-01-01T00:00:01 | 3 | 0 | 1970-01-01T00:00:04 |
|
|
+---+---+---------------------+---+---+---------------------+
|
|
|
|
-- FULL JOIN with complex expression
|
|
SELECT * FROM test FULL OUTER JOIN test2 ON test.a+test2.c=test.b+test2.b ORDER BY test.a NULLS FIRST;
|
|
|
|
+---+---+---------------------+---+---+---------------------+
|
|
| a | b | ts | b | c | ts |
|
|
+---+---+---------------------+---+---+---------------------+
|
|
| | | | 1 | 2 | 1970-01-01T00:00:03 |
|
|
| 2 | 2 | 1970-01-01T00:00:02 | | | |
|
|
| 4 | 1 | 1970-01-01T00:00:01 | 3 | 0 | 1970-01-01T00:00:04 |
|
|
+---+---+---------------------+---+---+---------------------+
|
|
|
|
-- Basic equi-join
|
|
SELECT * FROM test JOIN test2 ON test.b = test2.b ORDER BY test.a;
|
|
|
|
+---+---+---------------------+---+---+---------------------+
|
|
| a | b | ts | b | c | ts |
|
|
+---+---+---------------------+---+---+---------------------+
|
|
| 4 | 1 | 1970-01-01T00:00:01 | 1 | 2 | 1970-01-01T00:00:03 |
|
|
+---+---+---------------------+---+---+---------------------+
|
|
|
|
DROP TABLE test2;
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE test;
|
|
|
|
Affected Rows: 0
|
|
|