Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the tests into sql query test suit
- Loading branch information
1 parent
b432355
commit 160ea54
Showing
3 changed files
with
101 additions
and
25 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,17 @@ | ||
-- rand with the seed 0 | ||
SELECT rand(0); | ||
SELECT rand(cast(3 / 7 AS int)); | ||
SELECT rand(NULL); | ||
SELECT rand(cast(NULL AS int)); | ||
|
||
-- rand unsupported data type | ||
SELECT rand(1.0); | ||
|
||
-- randn with the seed 0 | ||
SELECT randn(0L); | ||
SELECT randn(cast(3 / 7 AS long)); | ||
SELECT randn(NULL); | ||
SELECT randn(cast(NULL AS long)); | ||
|
||
-- randn unsupported data type | ||
SELECT rand('1') |
84 changes: 84 additions & 0 deletions
84
sql/core/src/test/resources/sql-tests/results/random.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,84 @@ | ||
-- Automatically generated by SQLQueryTestSuite | ||
-- Number of queries: 10 | ||
|
||
|
||
-- !query 0 | ||
SELECT rand(0) | ||
-- !query 0 schema | ||
struct<rand(0):double> | ||
-- !query 0 output | ||
0.8446490682263027 | ||
|
||
|
||
-- !query 1 | ||
SELECT rand(cast(3 / 7 AS int)) | ||
-- !query 1 schema | ||
struct<rand(CAST((CAST(3 AS DOUBLE) / CAST(7 AS DOUBLE)) AS INT)):double> | ||
-- !query 1 output | ||
0.8446490682263027 | ||
|
||
|
||
-- !query 2 | ||
SELECT rand(NULL) | ||
-- !query 2 schema | ||
struct<rand(CAST(NULL AS INT)):double> | ||
-- !query 2 output | ||
0.8446490682263027 | ||
|
||
|
||
-- !query 3 | ||
SELECT rand(cast(NULL AS int)) | ||
-- !query 3 schema | ||
struct<rand(CAST(NULL AS INT)):double> | ||
-- !query 3 output | ||
0.8446490682263027 | ||
|
||
|
||
-- !query 4 | ||
SELECT rand(1.0) | ||
-- !query 4 schema | ||
struct<> | ||
-- !query 4 output | ||
org.apache.spark.sql.AnalysisException | ||
cannot resolve 'rand(1.0BD)' due to data type mismatch: argument 1 requires (int or bigint) type, however, '1.0BD' is of decimal(2,1) type.; line 1 pos 7 | ||
|
||
|
||
-- !query 5 | ||
SELECT randn(0L) | ||
-- !query 5 schema | ||
struct<randn(0):double> | ||
-- !query 5 output | ||
1.1164209726833079 | ||
|
||
|
||
-- !query 6 | ||
SELECT randn(cast(3 / 7 AS long)) | ||
-- !query 6 schema | ||
struct<randn(CAST((CAST(3 AS DOUBLE) / CAST(7 AS DOUBLE)) AS BIGINT)):double> | ||
-- !query 6 output | ||
1.1164209726833079 | ||
|
||
|
||
-- !query 7 | ||
SELECT randn(NULL) | ||
-- !query 7 schema | ||
struct<randn(CAST(NULL AS INT)):double> | ||
-- !query 7 output | ||
1.1164209726833079 | ||
|
||
|
||
-- !query 8 | ||
SELECT randn(cast(NULL AS long)) | ||
-- !query 8 schema | ||
struct<randn(CAST(NULL AS BIGINT)):double> | ||
-- !query 8 output | ||
1.1164209726833079 | ||
|
||
|
||
-- !query 9 | ||
SELECT rand('1') | ||
-- !query 9 schema | ||
struct<> | ||
-- !query 9 output | ||
org.apache.spark.sql.AnalysisException | ||
cannot resolve 'rand('1')' due to data type mismatch: argument 1 requires (int or bigint) type, however, ''1'' is of string type.; line 1 pos 7 |
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