Skip to content
Closed
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
[SPARK-39060][SQL] Typo in error messages of decimal overflow
  • Loading branch information
vitaliili-db committed May 3, 2022
commit a93bc3da632e1dac8833fcf5fc4f38ca29c19f55
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ final class Decimal extends Ordered[Decimal] with Serializable {

def toDebugString: String = {
if (decimalVal.ne(null)) {
s"Decimal(expanded,$decimalVal,$precision,$scale})"
s"Decimal(expanded, $decimalVal, $precision, $scale)"
} else {
s"Decimal(compact,$longVal,$precision,$scale})"
s"Decimal(compact, $longVal, $precision, $scale)"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ select cast('123.45' as decimal(4, 2))
struct<>
-- !query output
org.apache.spark.SparkArithmeticException
[CANNOT_CHANGE_DECIMAL_PRECISION] Decimal(expanded,123.45,5,2}) cannot be represented as Decimal(4, 2). If necessary set "spark.sql.ansi.enabled" to false to bypass this error.
[CANNOT_CHANGE_DECIMAL_PRECISION] Decimal(expanded, 123.45, 5, 2) cannot be represented as Decimal(4, 2). If necessary set "spark.sql.ansi.enabled" to false to bypass this error.
== SQL(line 1, position 7) ==
select cast('123.45' as decimal(4, 2))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ select (5e36BD + 0.1) + 5e36BD
struct<>
-- !query output
org.apache.spark.SparkArithmeticException
[CANNOT_CHANGE_DECIMAL_PRECISION] Decimal(expanded,10000000000000000000000000000000000000.1,39,1}) cannot be represented as Decimal(38, 1). If necessary set "spark.sql.ansi.enabled" to false to bypass this error.
[CANNOT_CHANGE_DECIMAL_PRECISION] Decimal(expanded, 10000000000000000000000000000000000000.1, 39, 1) cannot be represented as Decimal(38, 1). If necessary set "spark.sql.ansi.enabled" to false to bypass this error.
== SQL(line 1, position 7) ==
select (5e36BD + 0.1) + 5e36BD
^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -88,7 +88,7 @@ select (-4e36BD - 0.1) - 7e36BD
struct<>
-- !query output
org.apache.spark.SparkArithmeticException
[CANNOT_CHANGE_DECIMAL_PRECISION] Decimal(expanded,-11000000000000000000000000000000000000.1,39,1}) cannot be represented as Decimal(38, 1). If necessary set "spark.sql.ansi.enabled" to false to bypass this error.
[CANNOT_CHANGE_DECIMAL_PRECISION] Decimal(expanded, -11000000000000000000000000000000000000.1, 39, 1) cannot be represented as Decimal(38, 1). If necessary set "spark.sql.ansi.enabled" to false to bypass this error.
== SQL(line 1, position 7) ==
select (-4e36BD - 0.1) - 7e36BD
^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -100,7 +100,7 @@ select 12345678901234567890.0 * 12345678901234567890.0
struct<>
-- !query output
org.apache.spark.SparkArithmeticException
[CANNOT_CHANGE_DECIMAL_PRECISION] Decimal(expanded,152415787532388367501905199875019052100,39,0}) cannot be represented as Decimal(38, 2). If necessary set "spark.sql.ansi.enabled" to false to bypass this error.
[CANNOT_CHANGE_DECIMAL_PRECISION] Decimal(expanded, 152415787532388367501905199875019052100, 39, 0) cannot be represented as Decimal(38, 2). If necessary set "spark.sql.ansi.enabled" to false to bypass this error.
== SQL(line 1, position 7) ==
select 12345678901234567890.0 * 12345678901234567890.0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -112,7 +112,7 @@ select 1e35BD / 0.1
struct<>
-- !query output
org.apache.spark.SparkArithmeticException
[CANNOT_CHANGE_DECIMAL_PRECISION] Decimal(expanded,1000000000000000000000000000000000000,37,0}) cannot be represented as Decimal(38, 6). If necessary set "spark.sql.ansi.enabled" to false to bypass this error.
[CANNOT_CHANGE_DECIMAL_PRECISION] Decimal(expanded, 1000000000000000000000000000000000000, 37, 0) cannot be represented as Decimal(38, 6). If necessary set "spark.sql.ansi.enabled" to false to bypass this error.
== SQL(line 1, position 7) ==
select 1e35BD / 0.1
^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ select make_interval(0, 0, 0, 0, 0, 0, 1234567890123456789)
struct<>
-- !query output
org.apache.spark.SparkArithmeticException
[CANNOT_CHANGE_DECIMAL_PRECISION] Decimal(expanded,1234567890123456789,20,0}) cannot be represented as Decimal(18, 6). If necessary set "spark.sql.ansi.enabled" to false to bypass this error.
[CANNOT_CHANGE_DECIMAL_PRECISION] Decimal(expanded, 1234567890123456789, 20, 0) cannot be represented as Decimal(18, 6). If necessary set "spark.sql.ansi.enabled" to false to bypass this error.
== SQL(line 1, position 7) ==
select make_interval(0, 0, 0, 0, 0, 0, 1234567890123456789)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class QueryExecutionAnsiErrorsSuite extends QueryTest with QueryErrorsSuiteBase
},
errorClass = "CANNOT_CHANGE_DECIMAL_PRECISION",
msg =
"Decimal(expanded,66666666666666.666,17,3}) cannot be represented as Decimal(8, 1). " +
"Decimal(expanded, 66666666666666.666, 17, 3) cannot be represented as Decimal(8, 1). " +
s"If necessary set $ansiConf to false to bypass this error." +
"""
|== SQL(line 1, position 7) ==
Expand Down