[SPARK-42317][SQL] Assign name to _LEGACY_ERROR_TEMP_2247: CANNOT_MERGE_SCHEMAS#40810
[SPARK-42317][SQL] Assign name to _LEGACY_ERROR_TEMP_2247: CANNOT_MERGE_SCHEMAS#40810kori73 wants to merge 7 commits into
Conversation
Also improve the error message by adding both the left and right schemas
| messageParameters = Map( | ||
| "schema" -> schema.treeString), | ||
| errorClass = "CANNOT_MERGE_SCHEMAS", | ||
| messageParameters = Map("left" -> leftSchema.treeString, "right" -> rightSchema.treeString), |
There was a problem hiding this comment.
Could you wrap schemas by toSQLType() instead of rightSchema, please. BTW, the error occurs in PySpark, SQL, R, we show it in some common form as a SQL type.
There was a problem hiding this comment.
Thanks for the explanation. I have wrapped the schemas with toSQLType
| "left" -> df1.schema.treeString, | ||
| "right" -> df2.schema.treeString)) |
There was a problem hiding this comment.
Just embed the SQL types, please.
There was a problem hiding this comment.
wrapped with toSQLType here as well
|
@kori73 Could you update the example (output) according to the recent commit, please. |
updated the example according to the recent commit |
|
+1, LGTM. Merging to master. |
|
@kori73 Congratulations with your first contribution to Apache Spark! |
What changes were proposed in this pull request?
This PR proposes to assign name to _LEGACY_ERROR_TEMP_2247 as "CANNOT_MERGE_SCHEMAS".
Also proposes to display both left and right schemas in the exception so that one can compare them. Please let me know if you prefer the old error message with a single schema.
This is the stack trace after the changes:
Why are the changes needed?
We should assign proper name to LEGACY_ERROR_TEMP*
Does this PR introduce any user-facing change?
Yes, the users will see an improved error message.
How was this patch tested?
Changed an existing test case to test the new error class with
checkErrorutility.