itholic commented on code in PR #39937:
URL: https://github.com/apache/spark/pull/39937#discussion_r1260409364
##########
common/utils/src/main/resources/error/error-classes.json:
##########
@@ -840,6 +840,59 @@
"Detected an incompatible DataSourceRegister. Please remove the
incompatible library from classpath or upgrade it. Error: <message>"
]
},
+ "INCOMPATIBLE_DATA_FOR_TABLE" : {
+ "message" : [
+ "Cannot write incompatible data for table <tableName>:"
+ ],
+ "subClass" : {
+ "AMBIGUOUS_COLUMN_NAME" : {
+ "message" : [
+ "Ambiguous column name in the input data: <colPath>."
Review Comment:
I used the name `comPath` as they are used in the function where the error
actually occurs. e.g.
```scala
private def resolveColumnsByPosition(
tableName: String,
inputCols: Seq[NamedExpression],
expectedCols: Seq[Attribute],
conf: SQLConf,
addError: String => Unit,
colPath: Seq[String] = Nil): Seq[NamedExpression] = {
...
throw
QueryCompilationErrors.incompatibleDataToTableExtraStructFieldsError(
tableName, colPath.quoted, extraColsStr
)
```
However, it seems that `colName` would be a better choice. I will make the
necessary modifications.
##########
common/utils/src/main/resources/error/error-classes.json:
##########
@@ -840,6 +840,59 @@
"Detected an incompatible DataSourceRegister. Please remove the
incompatible library from classpath or upgrade it. Error: <message>"
]
},
+ "INCOMPATIBLE_DATA_FOR_TABLE" : {
+ "message" : [
+ "Cannot write incompatible data for table <tableName>:"
+ ],
+ "subClass" : {
+ "AMBIGUOUS_COLUMN_NAME" : {
+ "message" : [
+ "Ambiguous column name in the input data: <colPath>."
Review Comment:
I used the name `colPath` as they are used in the function where the error
actually occurs. e.g.
```scala
private def resolveColumnsByPosition(
tableName: String,
inputCols: Seq[NamedExpression],
expectedCols: Seq[Attribute],
conf: SQLConf,
addError: String => Unit,
colPath: Seq[String] = Nil): Seq[NamedExpression] = {
...
throw
QueryCompilationErrors.incompatibleDataToTableExtraStructFieldsError(
tableName, colPath.quoted, extraColsStr
)
```
However, it seems that `colName` would be a better choice. I will make the
necessary modifications.
--
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]