MaxGekk commented on code in PR #39282:
URL: https://github.com/apache/spark/pull/39282#discussion_r1059785870
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -2253,10 +2253,10 @@ private[sql] object QueryCompilationErrors extends
QueryErrorsBase {
def negativeScaleNotAllowedError(scale: Int): Throwable = {
new AnalysisException(
- errorClass = "_LEGACY_ERROR_TEMP_1230",
+ errorClass = "NEGATIVE_SCALE_NOT_ALLOWED",
messageParameters = Map(
"scale" -> scale.toString,
- "config" -> LEGACY_ALLOW_NEGATIVE_SCALE_OF_DECIMAL_ENABLED.key))
+ "allowNegativeConf" ->
LEGACY_ALLOW_NEGATIVE_SCALE_OF_DECIMAL_ENABLED.key))
Review Comment:
Please, quote it by `toSQLConf()`.
##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala:
##########
@@ -680,6 +680,18 @@ class QueryCompilationErrorsSuite
context = ExpectedContext("", "", 7, 13, "CAST(1)")
)
}
+
+ test("NEGATIVE_SCALE_NOT_ALLOWED: negative scale for Decimal is not
allowed") {
+ withSQLConf(SQLConf.LEGACY_ALLOW_NEGATIVE_SCALE_OF_DECIMAL_ENABLED.key ->
"false") {
+ checkError(
+ exception = intercept[AnalysisException] (Decimal(BigDecimal("98765"),
5, -3)),
Review Comment:
Can't you trigger the error by SQL?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]