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

feat:migrate select tests from DuckDB #2478

Closed
wants to merge 4 commits into from
Closed
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
149 changes: 149 additions & 0 deletions tests/cases/standalone/common/select/multi_column_reference.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
create schema test;

Affected Rows: 1

create table test.tbl(a int, b timestamp time index);

Affected Rows: 0

insert into test.tbl values (1,1), (2,2), (3,3);

Affected Rows: 3

select test.tbl.* from test.tbl;

+---+-------------------------+
| a | b |
+---+-------------------------+
| 1 | 1970-01-01T00:00:00.001 |
| 2 | 1970-01-01T00:00:00.002 |
| 3 | 1970-01-01T00:00:00.003 |
+---+-------------------------+

select test.tbl.a from test.tbl;

+---+
| a |
+---+
| 1 |
| 2 |
| 3 |
+---+

select test.tbl.b from test.tbl;

+-------------------------+
| b |
+-------------------------+
| 1970-01-01T00:00:00.001 |
| 1970-01-01T00:00:00.002 |
| 1970-01-01T00:00:00.003 |
+-------------------------+

select test.t.a from test.tbl t;

+---+
| a |
+---+
| 1 |
| 2 |
| 3 |
+---+

select test.tbl.a from test.tbl t;

Error: 3000(PlanQuery), No field named test.tbl.a. Valid fields are t.a, t.b.

-- check how ties are resolved
-- we create a table called "t" in a schema called "t" with a column called "t" that has a field called "t"
create schema t;

Affected Rows: 1

-- unsupported
-- create table t.t(t ROW(t int), b timestamp time index);
-- unsupported
drop schema t cascade;

Error: 1001(Unsupported), SQL statement is not supported: drop schema t cascade;, keyword: schema

-- test multiple tables with the same name but a different schema
-- we allow this (duplicate alias in query)
create schema s1;

Affected Rows: 1

create schema s2;

Affected Rows: 1

create table s1.t1(
a int,
b timestamp time index,
);

Affected Rows: 0

insert into s1.t1 values (1,1);

Affected Rows: 1

create table s2.t1(
a int,
b timestamp time index,
);

Affected Rows: 0

insert into s2.t1 values (2,1);

Affected Rows: 1

-- statement ok
select t1.a from s1.t1,s2.t1;

+---+
| a |
+---+
| 1 |
+---+

-- statement ok
select s1.t1.a from s1.t1,s2.t1;

+---+
| a |
+---+
| 1 |
+---+

-- statement error
select s2.t1.a from s1.t1,s2.t1;

Error: 1003(Internal), Invalid argument error: must either specify a row count or at least one column

-- statement ok
select s2.t1.a from s2.t1, s1.t1;

+---+
| a |
+---+
| 2 |
+---+

-- test various failures
-- statement error
select testX.tbl.a from test.tbl;

Error: 3000(PlanQuery), No field named testx.tbl.a. Valid fields are test.tbl.a, test.tbl.b.

-- statement error
select test.tblX.a from test.tbl;

Error: 3000(PlanQuery), No field named test.tblx.a. Valid fields are test.tbl.a, test.tbl.b.

-- statement error
select test.tbl.aX from test.tbl;

Error: 3000(PlanQuery), No field named test.tbl.ax. Valid fields are test.tbl.a, test.tbl.b.

67 changes: 67 additions & 0 deletions tests/cases/standalone/common/select/multi_column_reference.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
create schema test;

create table test.tbl(a int, b timestamp time index);

insert into test.tbl values (1,1), (2,2), (3,3);

select test.tbl.* from test.tbl;

select test.tbl.a from test.tbl;

select test.tbl.b from test.tbl;

select test.t.a from test.tbl t;

select test.tbl.a from test.tbl t;

-- check how ties are resolved
-- we create a table called "t" in a schema called "t" with a column called "t" that has a field called "t"
create schema t;

-- unsupported
-- create table t.t(t ROW(t int), b timestamp time index);

-- unsupported
drop schema t cascade;

-- test multiple tables with the same name but a different schema
-- we allow this (duplicate alias in query)
create schema s1;

create schema s2;

create table s1.t1(
a int,
b timestamp time index,
);

insert into s1.t1 values (1,1);

create table s2.t1(
a int,
b timestamp time index,
);

insert into s2.t1 values (2,1);

-- statement ok
select t1.a from s1.t1,s2.t1;

-- statement ok
select s1.t1.a from s1.t1,s2.t1;

-- statement error
select s2.t1.a from s1.t1,s2.t1;

-- statement ok
select s2.t1.a from s2.t1, s1.t1;

-- test various failures
-- statement error
select testX.tbl.a from test.tbl;

-- statement error
select test.tblX.a from test.tbl;

-- statement error
select test.tbl.aX from test.tbl;
21 changes: 21 additions & 0 deletions tests/cases/standalone/common/select/schema_reference.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- statement ok
create schema s1;

Affected Rows: 1

-- statement ok
create table s1.tbl(i int, b timestamp time index);

Affected Rows: 0

-- statement ok
select s1.tbl.i from s1.tbl;

++
++

-- statement error
select s2.tbl.i from s1.tbl;

Error: 3000(PlanQuery), No field named s2.tbl.i. Valid fields are s1.tbl.i, s1.tbl.b.

14 changes: 14 additions & 0 deletions tests/cases/standalone/common/select/schema_reference.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- statement ok
create schema s1;

-- statement ok
create table s1.tbl(i int, b timestamp time index);

-- statement ok
select s1.tbl.i from s1.tbl;

-- statement error
select s2.tbl.i from s1.tbl;

-- statement error
select a.tbl.i from range(10) tbl(i)
Loading