You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2023/01/01 19:07:40 UTC
[GitHub] [spark] MaxGekk commented on a diff in pull request #39282: [SPARK-41581][SQL] Assign name to _LEGACY_ERROR_TEMP_1230
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org