-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What problem does this PR solve? - Fix : IN statement also supports queries with the left operand being a constant. - Add test file for IN statement. Issue #1839 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [x] Test cases
- Loading branch information
Showing
2 changed files
with
89 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
statement ok | ||
DROP TABLE IF EXISTS test_in; | ||
|
||
statement ok | ||
CREATE TABLE test_in(num INTEGER, name VARCHAR, score FLOAT); | ||
|
||
statement ok | ||
INSERT INTO test_in values | ||
(1, 'Tom', 90.5), | ||
(2, 'Henry', 70.0), | ||
(3, 'james', 75.0), | ||
(4, 'Toby', 92.0), | ||
(5, 'Thomas', 72.5), | ||
(6, 'Charlie', 69.0), | ||
(7, 'Chris', 88.0), | ||
(8, 'Bill', 90.0), | ||
(9, 'Stefan', 86.5), | ||
(10, 'steve', 86.0); | ||
|
||
query III | ||
SELECT * FROM test_in where num in (3, 6, 9); | ||
---- | ||
3 james 75.000000 | ||
6 Charlie 69.000000 | ||
9 Stefan 86.500000 | ||
|
||
query III | ||
SELECT * FROM test_in where name in ('Tom', 'Toby', 'stevE'); | ||
---- | ||
1 Tom 90.500000 | ||
4 Toby 92.000000 | ||
|
||
query III | ||
SELECT * FROM test_in where score in ('90.5', '70.0', '86.5'); | ||
---- | ||
1 Tom 90.500000 | ||
2 Henry 70.000000 | ||
9 Stefan 86.500000 | ||
|
||
# some cast | ||
query III | ||
SELECT * FROM test_in where num in ('3', '6', '9'); | ||
---- | ||
3 james 75.000000 | ||
6 Charlie 69.000000 | ||
9 Stefan 86.500000 | ||
|
||
query III | ||
SELECT * FROM test_in where score in ('92', '70', '86'); | ||
---- | ||
2 Henry 70.000000 | ||
4 Toby 92.000000 | ||
10 steve 86.000000 | ||
|
||
# some functions in left operand | ||
query III | ||
SELECT * FROM test_in where num + 2 in ('3', '4', '5'); | ||
---- | ||
1 Tom 90.500000 | ||
2 Henry 70.000000 | ||
3 james 75.000000 | ||
|
||
# constant in left operand | ||
query III | ||
SELECT * FROM test_in where 4 in ('3', '4', '5'); | ||
---- | ||
1 Tom 90.500000 | ||
2 Henry 70.000000 | ||
3 james 75.000000 | ||
4 Toby 92.000000 | ||
5 Thomas 72.500000 | ||
6 Charlie 69.000000 | ||
7 Chris 88.000000 | ||
8 Bill 90.000000 | ||
9 Stefan 86.500000 | ||
10 steve 86.000000 | ||
|
||
statement ok | ||
DROP TABLE test_in; |