-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-17011][SQL] Support testing exceptions in SQLQueryTestSuite
## What changes were proposed in this pull request? This patch adds exception testing to SQLQueryTestSuite. When there is an exception in query execution, the query result contains the the exception class along with the exception message. As part of this, I moved some additional test cases for limit from SQLQuerySuite over to SQLQueryTestSuite. ## How was this patch tested? This is a test harness change. Author: petermaxlee <petermaxlee@gmail.com> Closes #14592 from petermaxlee/SPARK-17011.
- Loading branch information
1 parent
7a6a3c3
commit 0db373a
Showing
9 changed files
with
161 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
-- limit on various data types | ||
select * from testdata limit 2; | ||
select * from arraydata limit 2; | ||
select * from mapdata limit 2; | ||
|
||
-- foldable non-literal in limit | ||
select * from testdata limit 2 + 1; | ||
|
||
select * from testdata limit CAST(1 AS int); | ||
|
||
-- limit must be non-negative | ||
select * from testdata limit -1; | ||
|
||
-- limit must be foldable | ||
select * from testdata limit key > 3; | ||
|
||
-- limit must be integer | ||
select * from testdata limit true; | ||
select * from testdata limit 'a'; |
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
83 changes: 83 additions & 0 deletions
83
sql/core/src/test/resources/sql-tests/results/limit.sql.out
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,83 @@ | ||
-- Automatically generated by SQLQueryTestSuite | ||
-- Number of queries: 9 | ||
|
||
|
||
-- !query 0 | ||
select * from testdata limit 2 | ||
-- !query 0 schema | ||
struct<key:int,value:string> | ||
-- !query 0 output | ||
1 1 | ||
2 2 | ||
|
||
|
||
-- !query 1 | ||
select * from arraydata limit 2 | ||
-- !query 1 schema | ||
struct<arraycol:array<int>,nestedarraycol:array<array<int>>> | ||
-- !query 1 output | ||
[1,2,3] [[1,2,3]] | ||
[2,3,4] [[2,3,4]] | ||
|
||
|
||
-- !query 2 | ||
select * from mapdata limit 2 | ||
-- !query 2 schema | ||
struct<mapcol:map<int,string>> | ||
-- !query 2 output | ||
{1:"a1",2:"b1",3:"c1",4:"d1",5:"e1"} | ||
{1:"a2",2:"b2",3:"c2",4:"d2"} | ||
|
||
|
||
-- !query 3 | ||
select * from testdata limit 2 + 1 | ||
-- !query 3 schema | ||
struct<key:int,value:string> | ||
-- !query 3 output | ||
1 1 | ||
2 2 | ||
3 3 | ||
|
||
|
||
-- !query 4 | ||
select * from testdata limit CAST(1 AS int) | ||
-- !query 4 schema | ||
struct<key:int,value:string> | ||
-- !query 4 output | ||
1 1 | ||
|
||
|
||
-- !query 5 | ||
select * from testdata limit -1 | ||
-- !query 5 schema | ||
struct<> | ||
-- !query 5 output | ||
org.apache.spark.sql.AnalysisException | ||
The limit expression must be equal to or greater than 0, but got -1; | ||
|
||
|
||
-- !query 6 | ||
select * from testdata limit key > 3 | ||
-- !query 6 schema | ||
struct<> | ||
-- !query 6 output | ||
org.apache.spark.sql.AnalysisException | ||
The limit expression must evaluate to a constant value, but got (testdata.`key` > 3); | ||
|
||
|
||
-- !query 7 | ||
select * from testdata limit true | ||
-- !query 7 schema | ||
struct<> | ||
-- !query 7 output | ||
org.apache.spark.sql.AnalysisException | ||
The limit expression must be integer type, but got boolean; | ||
|
||
|
||
-- !query 8 | ||
select * from testdata limit 'a' | ||
-- !query 8 schema | ||
struct<> | ||
-- !query 8 output | ||
org.apache.spark.sql.AnalysisException | ||
The limit expression must be integer type, but got string; |
2 changes: 1 addition & 1 deletion
2
sql/core/src/test/resources/sql-tests/results/natural-join.sql.out
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
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