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 2687d784fe4 [SPARK-43882][SQL] Assign name to _LEGACY_ERROR_TEMP_2122 2687d784fe4 is described below commit 2687d784fe4d20af321f11074139c0ce382bbaef Author: Jia Fan <fanjiaemi...@qq.com> AuthorDate: Wed May 31 10:26:15 2023 +0300 [SPARK-43882][SQL] Assign name to _LEGACY_ERROR_TEMP_2122 ### What changes were proposed in this pull request? This PR proposes to assign name to _LEGACY_ERROR_TEMP_2122, "FAILED_PARSE_STRUCT_TYPE". ### Why are the changes needed? Assign proper name to _LEGACY_ERROR_TEMP_2122 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Add new test Closes #41381 from Hisoka-X/SPARK-43882_LEGACY_ERROR_TEMP_2122. Authored-by: Jia Fan <fanjiaemi...@qq.com> Signed-off-by: Max Gekk <max.g...@gmail.com> --- core/src/main/resources/error/error-classes.json | 11 ++++++----- .../org/apache/spark/sql/errors/QueryExecutionErrors.scala | 4 ++-- .../apache/spark/sql/errors/QueryExecutionErrorsSuite.scala | 10 ++++++++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/core/src/main/resources/error/error-classes.json b/core/src/main/resources/error/error-classes.json index 8c3ba1e190d..7f2b1975855 100644 --- a/core/src/main/resources/error/error-classes.json +++ b/core/src/main/resources/error/error-classes.json @@ -634,6 +634,12 @@ ], "sqlState" : "38000" }, + "FAILED_PARSE_STRUCT_TYPE" : { + "message" : [ + "Failed parsing struct: <raw>." + ], + "sqlState" : "22018" + }, "FAILED_RENAME_PATH" : { "message" : [ "Failed to rename <sourcePath> to <targetPath> as destination already exists." @@ -4563,11 +4569,6 @@ "Do not support type <clazz>." ] }, - "_LEGACY_ERROR_TEMP_2122" : { - "message" : [ - "Failed parsing <simpleString>: <raw>." - ] - }, "_LEGACY_ERROR_TEMP_2124" : { "message" : [ "Failed to merge decimal types with incompatible scale <leftScale> and <rightScale>." 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 5daa8ed3b7f..7ce3e7a9e7e 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 @@ -1305,8 +1305,8 @@ private[sql] object QueryExecutionErrors extends QueryErrorsBase { def failedParsingStructTypeError(raw: String): SparkRuntimeException = { new SparkRuntimeException( - errorClass = "_LEGACY_ERROR_TEMP_2122", - messageParameters = Map("simpleString" -> StructType.simpleString, "raw" -> raw)) + errorClass = "FAILED_PARSE_STRUCT_TYPE", + messageParameters = Map("raw" -> toSQLValue(raw, StringType))) } def cannotMergeDecimalTypesWithIncompatibleScaleError( diff --git a/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala index 4bcb1d115b7..6d2c2600cbb 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala @@ -633,6 +633,16 @@ class QueryExecutionErrorsSuite "config" -> s""""${SQLConf.ANSI_ENABLED.key}"""")) } + test("FAILED_PARSE_STRUCT_TYPE: parsing invalid struct type") { + val raw = """{"type":"array","elementType":"integer","containsNull":false}""" + checkError( + exception = intercept[SparkRuntimeException] { + StructType.fromString(raw) + }, + errorClass = "FAILED_PARSE_STRUCT_TYPE", + parameters = Map("raw" -> s"'$raw'")) + } + test("CAST_OVERFLOW: from long to ANSI intervals") { Seq( LongType -> "9223372036854775807L", --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org