You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ma...@apache.org on 2022/11/08 10:04:04 UTC
[spark] branch master updated: [SPARK-40663][SQL][FOLLOWUP] `SparkIllegalArgumentException` should accept `cause`
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 755ed4512dd [SPARK-40663][SQL][FOLLOWUP] `SparkIllegalArgumentException` should accept `cause`
755ed4512dd is described below
commit 755ed4512dded18406f77dc4708d11c16dc99b21
Author: itholic <ha...@databricks.com>
AuthorDate: Tue Nov 8 13:03:45 2022 +0300
[SPARK-40663][SQL][FOLLOWUP] `SparkIllegalArgumentException` should accept `cause`
### What changes were proposed in this pull request?
This PR proposes to enable `SparkIllegalArgumentException` accept `cause` parameter.
### Why are the changes needed?
The original error message generated by `IllegalArgumentException` can accept the `cause` parameter, but `SparkIllegalArgumentException` cannot, so there it some regression was made that we should enable back.
e.g. https://github.com/apache/spark/pull/38123/files#r1014645753
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
```
./build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite*"
```
Closes #38548 from itholic/SPARK-40633-followup.
Authored-by: itholic <ha...@databricks.com>
Signed-off-by: Max Gekk <ma...@gmail.com>
---
core/src/main/scala/org/apache/spark/SparkException.scala | 5 +++--
.../scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala | 6 ++++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/core/src/main/scala/org/apache/spark/SparkException.scala b/core/src/main/scala/org/apache/spark/SparkException.scala
index 9eecb5e2727..03938444e12 100644
--- a/core/src/main/scala/org/apache/spark/SparkException.scala
+++ b/core/src/main/scala/org/apache/spark/SparkException.scala
@@ -258,9 +258,10 @@ private[spark] class SparkIllegalArgumentException(
errorClass: String,
messageParameters: Map[String, String],
context: Array[QueryContext] = Array.empty,
- summary: String = "")
+ summary: String = "",
+ cause: Throwable = null)
extends IllegalArgumentException(
- SparkThrowableHelper.getMessage(errorClass, messageParameters, summary))
+ SparkThrowableHelper.getMessage(errorClass, messageParameters, summary), cause)
with SparkThrowable {
override def getMessageParameters: java.util.Map[String, String] = messageParameters.asJava
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 73e0f580727..aad9a9ba51e 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
@@ -367,7 +367,8 @@ private[sql] object QueryExecutionErrors extends QueryErrorsBase {
errorClass = "_LEGACY_ERROR_TEMP_2008",
messageParameters = Map(
"url" -> url.toString,
- "ansiConfig" -> toSQLConf(SQLConf.ANSI_ENABLED.key)))
+ "ansiConfig" -> toSQLConf(SQLConf.ANSI_ENABLED.key)),
+ cause = e)
}
def illegalUrlError(url: UTF8String): Throwable = {
@@ -1226,7 +1227,8 @@ private[sql] object QueryExecutionErrors extends QueryErrorsBase {
stats: String, e: NumberFormatException): SparkIllegalArgumentException = {
new SparkIllegalArgumentException(
errorClass = "_LEGACY_ERROR_TEMP_2113",
- messageParameters = Map("stats" -> stats))
+ messageParameters = Map("stats" -> stats),
+ cause = e)
}
def statisticNotRecognizedError(stats: String): SparkIllegalArgumentException = {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org