This is an automated email from the ASF dual-hosted git repository.
maxgekk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new f5e6b05e486e [SPARK-49643][SQL] Merge _LEGACY_ERROR_TEMP_2042 into
ARITHMETIC_OVERFLOW
f5e6b05e486e is described below
commit f5e6b05e486efb3d67fd06166ca8f103efb750dc
Author: Mihailo Milosevic <[email protected]>
AuthorDate: Wed Oct 16 23:24:39 2024 +0200
[SPARK-49643][SQL] Merge _LEGACY_ERROR_TEMP_2042 into ARITHMETIC_OVERFLOW
### What changes were proposed in this pull request?
Merging related legacy error to its proper class.
### Why are the changes needed?
We want to get remove legacy errors, as they are not properly migrated to
the new system of errors. Also,
[PR](https://github.com/apache/spark/pull/48206/files#diff-0ffd087e0d4e1618761a42c91b8712fd469e758f4789ca2fafdefff753fe81d5)
started getting to big, so this is an effort to split the change needed.
### Does this PR introduce _any_ user-facing change?
Yes, legacy error is now merged into ARITHMETIC_OVERFLOW.
### How was this patch tested?
Existing tests check that the error message stayed the same.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #48496 from mihailom-db/error2042.
Authored-by: Mihailo Milosevic <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
---
common/utils/src/main/resources/error/error-conditions.json | 5 -----
.../spark/sql/catalyst/expressions/intervalExpressions.scala | 2 +-
.../org/apache/spark/sql/errors/QueryExecutionErrors.scala | 10 ----------
.../sql/catalyst/expressions/IntervalExpressionsSuite.scala | 2 +-
4 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/common/utils/src/main/resources/error/error-conditions.json
b/common/utils/src/main/resources/error/error-conditions.json
index 502558c21faa..fdc00549cc08 100644
--- a/common/utils/src/main/resources/error/error-conditions.json
+++ b/common/utils/src/main/resources/error/error-conditions.json
@@ -6864,11 +6864,6 @@
"<methodName> is not implemented."
]
},
- "_LEGACY_ERROR_TEMP_2042" : {
- "message" : [
- "<message>. If necessary set <ansiConfig> to false to bypass this error."
- ]
- },
"_LEGACY_ERROR_TEMP_2045" : {
"message" : [
"Unsupported table change: <message>"
diff --git
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/intervalExpressions.scala
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/intervalExpressions.scala
index 13676733a9ba..d18630f54202 100644
---
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/intervalExpressions.scala
+++
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/intervalExpressions.scala
@@ -336,7 +336,7 @@ case class MakeInterval(
val iu = IntervalUtils.getClass.getName.stripSuffix("$")
val secFrac = sec.getOrElse("0")
val failOnErrorBranch = if (failOnError) {
- "throw QueryExecutionErrors.arithmeticOverflowError(e);"
+ """throw QueryExecutionErrors.arithmeticOverflowError(e.getMessage(),
"", null);"""
} else {
s"${ev.isNull} = true;"
}
diff --git
a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala
b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala
index ebcc98a3af27..edc1b909292d 100644
---
a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala
+++
b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala
@@ -599,16 +599,6 @@ private[sql] object QueryExecutionErrors extends
QueryErrorsBase with ExecutionE
messageParameters = Map("methodName" -> methodName))
}
- def arithmeticOverflowError(e: ArithmeticException):
SparkArithmeticException = {
- new SparkArithmeticException(
- errorClass = "_LEGACY_ERROR_TEMP_2042",
- messageParameters = Map(
- "message" -> e.getMessage,
- "ansiConfig" -> toSQLConf(SQLConf.ANSI_ENABLED.key)),
- context = Array.empty,
- summary = "")
- }
-
def binaryArithmeticCauseOverflowError(
eval1: Short,
symbol: String,
diff --git
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/IntervalExpressionsSuite.scala
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/IntervalExpressionsSuite.scala
index 7caf23490a0c..78bc77b9dc2a 100644
---
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/IntervalExpressionsSuite.scala
+++
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/IntervalExpressionsSuite.scala
@@ -266,7 +266,7 @@ class IntervalExpressionsSuite extends SparkFunSuite with
ExpressionEvalHelper {
val intervalExpr = MakeInterval(Literal(years), Literal(months),
Literal(weeks),
Literal(days), Literal(hours), Literal(minutes),
Literal(Decimal(secFrac, Decimal.MAX_LONG_DIGITS, 6)))
- checkExceptionInExpression[ArithmeticException](intervalExpr, EmptyRow,
"")
+ checkExceptionInExpression[ArithmeticException](intervalExpr, EmptyRow,
"ARITHMETIC_OVERFLOW")
}
withSQLConf(SQLConf.ANSI_ENABLED.key -> "true") {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]