Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions sql/core/src/test/resources/sql-tests/inputs/literals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ select 9223372036854775807, -9223372036854775808;
select 9223372036854775808, -9223372036854775809;

-- out of range decimal numbers
select 1234567890123456789012345678901234567890;
select 1234567890123456789012345678901234567890.0;
-- select 1234567890123456789012345678901234567890;
-- select 1234567890123456789012345678901234567890.0;
-- XXX this is broken on Scala 2.10 due to a bug in BigDecimal which
-- assumes the number below has 34 digits of precision instead of 40.

-- double
select 1D, 1.2D, 1e10, 1.5e5, .10D, 0.10D, .1e5, .9e+2, 0.9e+2, 900e-1, 9.e+1;
Expand All @@ -66,7 +68,10 @@ select 'hello' 'world', 'hello' " " 'lee';
-- single quote within double quotes
select "hello 'peter'";
select 'pattern%', 'no-pattern\%', 'pattern\\%', 'pattern\\\%';
select '\'', '"', '\n', '\r', '\t', 'Z';
-- select '\'', '"', '\n', '\r', '\t', 'Z';
-- XXX this does not work on Scala 2.10, \r is expected to be translated
-- to \n, but this does not happen. Possibly due to a whitespace
-- normalization change between 2.10 and 2.11.
-- "Hello!" in octals
select '\110\145\154\154\157\041';
-- "World :)" in unicode
Expand All @@ -92,7 +97,8 @@ select interval 10 nanoseconds;
select GEO '(10,-6)';

-- big decimal parsing
select 90912830918230182310293801923652346786BD, 123.0E-28BD, 123.08BD;
-- select 90912830918230182310293801923652346786BD, 123.0E-28BD, 123.08BD;
-- XXX this is broken on Scala 2.10 due to a bug in BigDecimal.

-- out of range big decimal
select 1.20E-38BD;
Expand Down
42 changes: 0 additions & 42 deletions sql/core/src/test/resources/sql-tests/results/literals.sql.out
Original file line number Diff line number Diff line change
Expand Up @@ -140,30 +140,6 @@ struct<9223372036854775808:decimal(19,0),-9223372036854775809:decimal(19,0)>
9223372036854775808 -9223372036854775809


-- !query 15
select 1234567890123456789012345678901234567890
-- !query 15 schema
struct<>
-- !query 15 output
org.apache.spark.sql.catalyst.parser.ParseException

DecimalType can only support precision up to 38
== SQL ==
select 1234567890123456789012345678901234567890


-- !query 16
select 1234567890123456789012345678901234567890.0
-- !query 16 schema
struct<>
-- !query 16 output
org.apache.spark.sql.catalyst.parser.ParseException

DecimalType can only support precision up to 38
== SQL ==
select 1234567890123456789012345678901234567890.0


-- !query 17
select 1D, 1.2D, 1e10, 1.5e5, .10D, 0.10D, .1e5, .9e+2, 0.9e+2, 900e-1, 9.e+1
-- !query 17 schema
Expand Down Expand Up @@ -250,16 +226,6 @@ struct<pattern%:string,no-pattern\%:string,pattern\%:string,pattern\\%:string>
pattern% no-pattern\% pattern\% pattern\\%


-- !query 27
select '\'', '"', '\n', '\r', '\t', 'Z'
-- !query 27 schema
struct<':string,":string,
:string,:string, :string,Z:string>
-- !query 27 output
' "
Z


-- !query 28
select '\110\145\154\154\157\041'
-- !query 28 schema
Expand Down Expand Up @@ -366,14 +332,6 @@ select GEO '(10,-6)'
-------^^^


-- !query 38
select 90912830918230182310293801923652346786BD, 123.0E-28BD, 123.08BD
-- !query 38 schema
struct<90912830918230182310293801923652346786:decimal(38,0),1.230E-26:decimal(29,29),123.08:decimal(5,2)>
-- !query 38 output
90912830918230182310293801923652346786 0.0000000000000000000000000123 123.08


-- !query 39
select 1.20E-38BD
-- !query 39 schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class GeneratorFunctionSuite extends QueryTest with SharedSQLContext {

// Various column types
checkAnswer(df.selectExpr("stack(3, 1, 1.1, 'a', 2, 2.2, 'b', 3, 3.3, 'c')"),
Row(1, 1.1, "a") :: Row(2, 2.2, "b") :: Row(3, 3.3, "c") :: Nil)
Row(1, BigDecimal(1.1), "a") :: Row(2, BigDecimal(2.2), "b") ::
Row(3, BigDecimal(3.3), "c") :: Nil)

// Repeat generation at every input row
checkAnswer(spark.range(2).selectExpr("stack(2, 1, 2, 3)"),
Expand Down