-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
402 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# scalar having | ||
query I | ||
select 42 having 42 > 18 | ||
---- | ||
42 | ||
|
||
# scalar having | ||
query I | ||
select 42 having 42 > 801 | ||
---- | ||
|
||
statement ok | ||
CREATE TABLE test (x INT, y INT); | ||
|
||
statement ok | ||
INSERT INTO test VALUES (1, 2), (2, 2), (11, 22) | ||
|
||
query II | ||
select y as b, sum(x) as sum from test group by b having b = 2 | ||
---- | ||
2 3 | ||
|
||
query II | ||
select count(x) as a, y as b from test group by b having a > 1 | ||
---- | ||
2 2 | ||
|
||
query II | ||
select count(x) as a, y + 1 as b from test group by b having b + 1 = 24; | ||
---- | ||
1 23 | ||
|
||
query II | ||
select x from test group by x having max(y) = 22 | ||
---- | ||
11 | ||
|
||
query II | ||
select y + 1 as i from test group by y + 1 having count(x) > 1 and y + 1 = 3 or y + 1 = 23 order by i; | ||
---- | ||
3 | ||
23 | ||
|
||
statement error | ||
select count(x) from test group by count(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
statement ok | ||
create table x(a int, b int); | ||
|
||
statement ok | ||
create table y(c int, d int); | ||
|
||
statement ok | ||
insert into x values (1, 2), (1, 3); | ||
|
||
query IIII | ||
select a, b, c, d from x join y on a = c; | ||
---- | ||
|
||
statement ok | ||
insert into y values (1, 5), (1, 6), (2, 7); | ||
|
||
query IIII | ||
select a, b, c, d from x join y on a = c; | ||
---- | ||
1 2 1 5 | ||
1 3 1 5 | ||
1 2 1 6 | ||
1 3 1 6 | ||
|
||
query IIII | ||
select a, b, c, d from x, y; | ||
---- | ||
1 2 1 5 | ||
1 3 1 5 | ||
1 2 1 6 | ||
1 3 1 6 | ||
1 2 2 7 | ||
1 3 2 7 | ||
|
||
query IIII | ||
select a, b, c, d from x cross join y; | ||
---- | ||
1 2 1 5 | ||
1 3 1 5 | ||
1 2 1 6 | ||
1 3 1 6 | ||
1 2 2 7 | ||
1 3 2 7 | ||
|
||
statement ok | ||
drop table x; | ||
|
||
statement ok | ||
drop table y; | ||
|
||
statement ok | ||
create table a(v1 int, v2 int); | ||
|
||
statement ok | ||
create table b(v3 int, v4 int); | ||
|
||
statement ok | ||
insert into a values (1, 1), (2, 2), (3, 3); | ||
|
||
query IIII rowsort | ||
select v1, v2, v3, v4 from a left join b on v1 = v3; | ||
---- | ||
1 1 NULL NULL | ||
2 2 NULL NULL | ||
3 3 NULL NULL | ||
|
||
query I | ||
select v1, v2, v3, v4 from a, b; | ||
---- | ||
|
||
statement ok | ||
insert into b values (1, 100), (3, 300), (4, 400); | ||
|
||
query IIII | ||
select v1, v2, v3, v4 from a left join b on v1 = v3; | ||
---- | ||
1 1 1 100 | ||
3 3 3 300 | ||
2 2 NULL NULL | ||
|
||
statement ok | ||
drop table a; | ||
|
||
statement ok | ||
drop table b; | ||
|
||
statement ok | ||
create table a(v1 int, v2 int); | ||
|
||
statement ok | ||
create table b(v3 int, v4 int, v5 int); | ||
|
||
statement ok | ||
insert into a values (1, 1), (2, 2), (3, 3); | ||
|
||
statement ok | ||
insert into b values (1, 1, 1), (2, 2, 2), (3, 3, 4), (1, 1, 5); | ||
|
||
query IIIII | ||
select v1, v2, v3, v4, v5 from a join b on v1 = v3 and v2 = v4; | ||
---- | ||
1 1 1 1 1 | ||
2 2 2 2 2 | ||
3 3 3 3 4 | ||
1 1 1 1 5 | ||
|
||
query IIIII | ||
select v1, v2, v3, v4, v5 from a join b on v1 = v3 and v2 = v4 and v1 < v5; | ||
---- | ||
3 3 3 3 4 | ||
1 1 1 1 5 | ||
|
||
statement ok | ||
drop table a; | ||
|
||
statement ok | ||
drop table b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
statement ok | ||
create table x(a int, b int); | ||
|
||
statement ok | ||
create table y(c int, d int); | ||
|
||
statement ok | ||
insert into x values (1, 2), (2, 3); | ||
|
||
query II | ||
select a, b from x left semi join y on a = c; | ||
---- | ||
|
||
query II | ||
select a, b from x left anti join y on a = c; | ||
---- | ||
1 2 | ||
2 3 | ||
|
||
statement ok | ||
insert into y values (2, 5), (3, 7); | ||
|
||
# hash join | ||
query II | ||
select a, b from x left semi join y on a = c; | ||
---- | ||
2 3 | ||
|
||
query II | ||
select a, b from x left anti join y on a = c; | ||
---- | ||
1 2 | ||
|
||
# nested loop join | ||
query II | ||
select a, b from x left semi join y on a >= c; | ||
---- | ||
2 3 | ||
|
||
query II | ||
select a, b from x left anti join y on a >= c; | ||
---- | ||
1 2 | ||
|
||
statement ok | ||
drop table x; | ||
|
||
statement ok | ||
drop table y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
statement ok | ||
create table t(v1 int not null, v2 int not null) | ||
|
||
statement ok | ||
insert into t values (1, 1), (4, 2), (3, 3), (10, 12), (2, 5) | ||
|
||
query I | ||
select v1 from t limit 3 | ||
---- | ||
1 | ||
4 | ||
3 | ||
|
||
query I | ||
select v1 from t offset 2 | ||
---- | ||
3 | ||
10 | ||
2 | ||
|
||
query I | ||
select v1 from t limit 2 offset 2 | ||
---- | ||
3 | ||
10 | ||
|
||
query I | ||
select v1 from t limit 6 | ||
---- | ||
1 | ||
4 | ||
3 | ||
10 | ||
2 | ||
|
||
query I | ||
select v1 from t limit 0 | ||
---- | ||
|
||
query I | ||
select v1 from t offset 5 | ||
---- | ||
|
||
# test case for https://github.com/risinglightdb/risinglight/issues/264 | ||
statement ok | ||
insert into t values (1, 1) | ||
|
||
query I | ||
select v1 from t limit 0 | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
statement ok | ||
create table t(v1 int not null, v2 int not null) | ||
|
||
statement ok | ||
insert into t values(1, 1), (4, 2), (3, 3), (10, 12), (2, 5) | ||
|
||
query I | ||
select v1 from t order by v1 asc | ||
---- | ||
1 | ||
2 | ||
3 | ||
4 | ||
10 | ||
|
||
query I | ||
select v1 from t order by v1 desc | ||
---- | ||
10 | ||
4 | ||
3 | ||
2 | ||
1 | ||
|
||
statement ok | ||
drop table t | ||
|
||
|
||
statement ok | ||
create table t(v1 int not null, v2 int not null) | ||
|
||
statement ok | ||
insert into t values (1, 0), ( 2, 2), (3, 15), (2, 12), (3, 9), (1, 5) | ||
|
||
query II | ||
select v1, v2 from t order by v1 asc, v2 desc | ||
---- | ||
1 5 | ||
1 0 | ||
2 12 | ||
2 2 | ||
3 15 | ||
3 9 | ||
|
||
statement ok | ||
drop table t | ||
|
||
|
||
# sort with NULL | ||
statement ok | ||
create table t(v1 int, v2 int) | ||
|
||
statement ok | ||
insert into t values (1, 0), (2, 2), (NULL, 5), (2, NULL) | ||
|
||
query II | ||
select v1, v2 from t order by v1 asc, v2 asc | ||
---- | ||
NULL 5 | ||
1 0 | ||
2 NULL | ||
2 2 | ||
|
||
statement ok | ||
drop table t | ||
|
||
# sort on alias | ||
statement ok | ||
create table t(v1 int, v2 int) | ||
|
||
statement ok | ||
insert into t values(1, 1), (4, 2), (3, 3), (10, 12), (2, 5) | ||
|
||
query I | ||
select v1 as a from t order by a | ||
---- | ||
1 | ||
2 | ||
3 | ||
4 | ||
10 | ||
|
||
statement ok | ||
drop table t |
Oops, something went wrong.