Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-49904][SQL] Assign proper error condition for _LEGACY_ERROR_TEMP_2140 #48381

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions common/utils/src/main/resources/error/error-conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2578,6 +2578,13 @@
},
"sqlState" : "42K0K"
},
"INVALID_JAVA_IDENTIFIER_AS_FIELD_NAME" : {
"message" : [
"`<fieldName>` is not a valid identifier of Java and cannot be used as field name",
itholic marked this conversation as resolved.
Show resolved Hide resolved
"<walkedTypePath>."
],
"sqlState" : "42601"
itholic marked this conversation as resolved.
Show resolved Hide resolved
},
"INVALID_JOIN_TYPE_FOR_JOINWITH" : {
"message" : [
"Invalid join type in joinWith: <joinType>."
Expand Down Expand Up @@ -7172,12 +7179,6 @@
"cannot have circular references in class, but got the circular reference of class <t>."
]
},
"_LEGACY_ERROR_TEMP_2140" : {
"message" : [
"`<fieldName>` is not a valid identifier of Java and cannot be used as field name",
"<walkedTypePath>."
]
},
"_LEGACY_ERROR_TEMP_2144" : {
"message" : [
"Unable to find constructor for <tpe>. This could happen if <tpe> is an interface, or a trait without companion object constructor."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private[sql] trait ExecutionErrors extends DataTypeErrorsBase {
fieldName: String,
walkedTypePath: WalkedTypePath): SparkUnsupportedOperationException = {
new SparkUnsupportedOperationException(
errorClass = "_LEGACY_ERROR_TEMP_2140",
errorClass = "INVALID_JAVA_IDENTIFIER_AS_FIELD_NAME",
messageParameters =
Map("fieldName" -> fieldName, "walkedTypePath" -> walkedTypePath.toString))
itholic marked this conversation as resolved.
Show resolved Hide resolved
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class ScalaReflectionRelationSuite extends SparkFunSuite with SharedSparkSession
exception = intercept[SparkUnsupportedOperationException] {
Seq(InvalidInJava(1)).toDS()
},
condition = "_LEGACY_ERROR_TEMP_2140",
condition = "INVALID_JAVA_IDENTIFIER_AS_FIELD_NAME",
parameters = Map(
"fieldName" -> "abstract",
"walkedTypePath" -> "- root class: \"org.apache.spark.sql.InvalidInJava\""))
Expand All @@ -174,7 +174,7 @@ class ScalaReflectionRelationSuite extends SparkFunSuite with SharedSparkSession
exception = intercept[SparkUnsupportedOperationException] {
Seq(InvalidInJava2(1)).toDS()
},
condition = "_LEGACY_ERROR_TEMP_2140",
condition = "INVALID_JAVA_IDENTIFIER_AS_FIELD_NAME",
parameters = Map(
"fieldName" -> "0",
"walkedTypePath" ->
Expand Down