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
11 changes: 6 additions & 5 deletions common/utils/src/main/resources/error/error-conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2655,6 +2655,12 @@
],
"sqlState" : "2203G"
},
"INVALID_JSON_RECORD_TYPE" : {
"message" : [
"Detected an invalid type of a JSON record while inferring a common schema in the mode <failFastMode>. Expected a STRUCT type, but found <invalidType>."
],
"sqlState" : "22023"
},
"INVALID_JSON_ROOT_FIELD" : {
"message" : [
"Cannot convert JSON root field to target Spark type."
Expand Down Expand Up @@ -7284,11 +7290,6 @@
"Malformed JSON."
]
},
"_LEGACY_ERROR_TEMP_2167" : {
"message" : [
"Malformed records are detected in schema inference. Parse Mode: <failFastMode>. Reasons: Failed to infer a common schema. Struct types are expected, but `<dataType>` was found."
]
},
"_LEGACY_ERROR_TEMP_2168" : {
"message" : [
"Decorrelate inner query through <plan> is not supported."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1437,10 +1437,10 @@ private[sql] object QueryExecutionErrors extends QueryErrorsBase with ExecutionE

def malformedRecordsDetectedInSchemaInferenceError(dataType: DataType): Throwable = {
new SparkException(
errorClass = "_LEGACY_ERROR_TEMP_2167",
errorClass = "INVALID_JSON_RECORD_TYPE",
messageParameters = Map(
"failFastMode" -> FailFastMode.name,
"dataType" -> dataType.catalogString),
"invalidType" -> toSQLType(dataType)),
cause = null)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2078,8 +2078,8 @@ abstract class JsonSuite
.option("mode", "FAILFAST")
.json(path)
},
condition = "_LEGACY_ERROR_TEMP_2167",
parameters = Map("failFastMode" -> "FAILFAST", "dataType" -> "string|bigint"))
condition = "INVALID_JSON_RECORD_TYPE",
parameters = Map("failFastMode" -> "FAILFAST", "invalidType" -> "\"STRING\"|\"BIGINT\""))

val ex = intercept[SparkException] {
spark.read
Expand Down