itholic commented on code in PR #39258:
URL: https://github.com/apache/spark/pull/39258#discussion_r1059240891
##########
core/src/main/resources/error/error-classes.json:
##########
@@ -851,6 +851,11 @@
"Cannot name the managed table as <identifier>, as its associated
location <location> already exists. Please pick a different table name, or
remove the existing location first."
]
},
+ "MALFORMED_CSV_RECORD" : {
+ "message" : [
+ "Malformed CSV record. The number of tokens <tokenLength> doesn't match
the schema <schemaLength>."
Review Comment:
Seems like this exception is triggered when checking the schema before
parsing the actual input row.
Maybe should we fix the error class name and message more properly?
For example:
```json
"MALFORMED_CSV_SCHEMA" : {
"message" : [
"Malformed CSV schema. The number of tokens <tokenLength> doesn't
match the schema <schemaLength>."
]
}
```
Or maybe we can just show the malformed schema itself?
```json
"MALFORMED_CSV_SCHEMA" : {
"message" : [
"Malformed CSV schema. <malformedSchema>."
]
}
```
This will display look like:
```
[MALFORMED_CSV_RECORD] Malformed CSV schema:
StructType(StructField(year,StringType,true),StructField(make,StringType,true),StructField(model,StringType,true),StructField(comment,StringType,true),StructField(blank,StringType,true))
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]