Skip to content

Commit

Permalink
Adjust test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
beliefer committed Jan 20, 2020
1 parent 4039194 commit d18c591
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ SELECT '' AS zero, unique1, unique2, stringu1
SELECT '' AS eleven, unique1, unique2, stringu1
FROM onek WHERE unique1 < 50
ORDER BY unique1 DESC LIMIT 20 OFFSET 39;
SET spark.sql.forceUsingOffsetWithoutLimit = true;
SELECT '' AS ten, unique1, unique2, stringu1
FROM onek
ORDER BY unique1 OFFSET 990;
SET spark.sql.forceUsingOffsetWithoutLimit = false;
-- SELECT '' AS five, unique1, unique2, stringu1
-- FROM onek
-- ORDER BY unique1 OFFSET 990 LIMIT 5;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Automatically generated by SQLQueryTestSuite
-- Number of queries: 13
-- Number of queries: 15


-- !query 0
Expand Down Expand Up @@ -81,34 +81,55 @@ struct<eleven:string,unique1:int,unique2:int,stringu1:string>


-- !query 6
SELECT '' AS ten, unique1, unique2, stringu1
FROM onek
ORDER BY unique1 OFFSET 990
SET spark.sql.forceUsingOffsetWithoutLimit = true
-- !query 6 schema
struct<>
struct<key:string,value:string>
-- !query 6 output
org.apache.spark.sql.AnalysisException
Only the OFFSET clause is allowed in the LIMIT clause, but the OFFSET
clause is found to be the outermost node. If you know exactly that OFFSET
clause does not cause excessive overhead and still want to use it, set
spark.sql.forceUsingOffsetWithoutLimit to true.;
spark.sql.forceUsingOffsetWithoutLimit true


-- !query 7
SELECT '' AS ten, unique1, unique2, stringu1
FROM onek
ORDER BY unique1 OFFSET 990
-- !query 7 schema
struct<ten:string,unique1:int,unique2:int,stringu1:string>
-- !query 7 output
990 369 CMAAAA
991 426 DMAAAA
992 363 EMAAAA
993 661 FMAAAA
994 695 GMAAAA
995 144 HMAAAA
996 258 IMAAAA
997 21 JMAAAA
998 549 KMAAAA
999 152 LMAAAA


-- !query 8
SET spark.sql.forceUsingOffsetWithoutLimit = false
-- !query 8 schema
struct<key:string,value:string>
-- !query 8 output
spark.sql.forceUsingOffsetWithoutLimit false


-- !query 9
SELECT '' AS five, unique1, unique2, stringu1
FROM onek
ORDER BY unique1 LIMIT 5 OFFSET 900
-- !query 7 schema
-- !query 9 schema
struct<five:string,unique1:int,unique2:int,stringu1:string>
-- !query 7 output
-- !query 9 output
900 913 QIAAAA
901 931 RIAAAA
902 702 SIAAAA
903 641 TIAAAA
904 793 UIAAAA


-- !query 8
-- !query 10
CREATE OR REPLACE TEMPORARY VIEW INT8_TBL AS SELECT * FROM
(VALUES
(123, 456),
Expand All @@ -117,44 +138,44 @@ CREATE OR REPLACE TEMPORARY VIEW INT8_TBL AS SELECT * FROM
(4567890123456789, 4567890123456789),
(4567890123456789, -4567890123456789))
AS v(q1, q2)
-- !query 8 schema
-- !query 10 schema
struct<>
-- !query 8 output
-- !query 10 output



-- !query 9
-- !query 11
select * from int8_tbl limit (case when random() < 0.5 then bigint(null) end)
-- !query 9 schema
-- !query 11 schema
struct<>
-- !query 9 output
-- !query 11 output
org.apache.spark.sql.AnalysisException
The limit expression must evaluate to a constant value, but got CASE WHEN (`_nondeterministic` < CAST(0.5BD AS DOUBLE)) THEN CAST(NULL AS BIGINT) END;


-- !query 10
-- !query 12
select * from int8_tbl offset (case when random() < 0.5 then bigint(null) end)
-- !query 10 schema
-- !query 12 schema
struct<>
-- !query 10 output
-- !query 12 output
org.apache.spark.sql.AnalysisException
The offset expression must evaluate to a constant value, but got CASE WHEN (`_nondeterministic` < CAST(0.5BD AS DOUBLE)) THEN CAST(NULL AS BIGINT) END;


-- !query 11
-- !query 13
DROP VIEW INT8_TBL
-- !query 11 schema
-- !query 13 schema
struct<>
-- !query 11 output
-- !query 13 output



-- !query 12
-- !query 14
select sum(tenthous) as s1, sum(tenthous) + random()*0 as s2
from tenk1 group by thousand order by thousand limit 3
-- !query 12 schema
-- !query 14 schema
struct<s1:bigint,s2:double>
-- !query 12 output
-- !query 14 output
45000 45000.0
45010 45010.0
45020 45020.0

0 comments on commit d18c591

Please sign in to comment.