Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
16 changes: 6 additions & 10 deletions common/utils/src/main/resources/error/error-conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,12 @@
],
"sqlState" : "56000"
},
"CIRCULAR_CLASS_REFERENCE" : {
"message" : [
"Cannot have circular references in class, but got the circular reference of class <t>."
],
"sqlState" : "42602"
},
"CLASS_NOT_OVERRIDE_EXPECTED_METHOD" : {
"message" : [
"<className> must override either <method1> or <method2>."
Expand Down Expand Up @@ -7325,16 +7331,6 @@
"Exception when registering StreamingQueryListener."
]
},
"_LEGACY_ERROR_TEMP_2138" : {
"message" : [
"Cannot have circular references in bean class, but got the circular reference of class <clazz>."
]
},
"_LEGACY_ERROR_TEMP_2139" : {
"message" : [
"cannot have circular references in class, but got the circular reference of class <t>."
]
},
"_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 @@ -175,8 +175,8 @@ private[sql] trait ExecutionErrors extends DataTypeErrorsBase {
def cannotHaveCircularReferencesInBeanClassError(
clazz: Class[_]): SparkUnsupportedOperationException = {
new SparkUnsupportedOperationException(
errorClass = "_LEGACY_ERROR_TEMP_2138",
messageParameters = Map("clazz" -> clazz.toString))
errorClass = "CIRCULAR_CLASS_REFERENCE",
messageParameters = Map("t" -> toSQLValue(clazz.toString)))
}

def cannotFindConstructorForTypeError(tpe: String): SparkUnsupportedOperationException = {
Expand All @@ -187,8 +187,8 @@ private[sql] trait ExecutionErrors extends DataTypeErrorsBase {

def cannotHaveCircularReferencesInClassError(t: String): SparkUnsupportedOperationException = {
new SparkUnsupportedOperationException(
errorClass = "_LEGACY_ERROR_TEMP_2139",
messageParameters = Map("t" -> t))
errorClass = "CIRCULAR_CLASS_REFERENCE",
messageParameters = Map("t" -> toSQLValue(t)))
}

def cannotUseInvalidJavaIdentifierAsFieldNameError(
Expand Down
12 changes: 6 additions & 6 deletions sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1926,20 +1926,20 @@ class DatasetSuite extends QueryTest
exception = intercept[SparkUnsupportedOperationException] {
Seq(CircularReferenceClassA(null)).toDS()
},
condition = "_LEGACY_ERROR_TEMP_2139",
parameters = Map("t" -> "org.apache.spark.sql.CircularReferenceClassA"))
condition = "CIRCULAR_CLASS_REFERENCE",
parameters = Map("t" -> "'org.apache.spark.sql.CircularReferenceClassA'"))
checkError(
exception = intercept[SparkUnsupportedOperationException] {
Seq(CircularReferenceClassC(null)).toDS()
},
condition = "_LEGACY_ERROR_TEMP_2139",
parameters = Map("t" -> "org.apache.spark.sql.CircularReferenceClassC"))
condition = "CIRCULAR_CLASS_REFERENCE",
parameters = Map("t" -> "'org.apache.spark.sql.CircularReferenceClassC'"))
checkError(
exception = intercept[SparkUnsupportedOperationException] {
Seq(CircularReferenceClassD(null)).toDS()
},
condition = "_LEGACY_ERROR_TEMP_2139",
parameters = Map("t" -> "org.apache.spark.sql.CircularReferenceClassD"))
condition = "CIRCULAR_CLASS_REFERENCE",
parameters = Map("t" -> "'org.apache.spark.sql.CircularReferenceClassD'"))
}

test("SPARK-20125: option of map") {
Expand Down