-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-40750][SQL] Migrate type check failures of math expressions onto error classes #38332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Can one of the admins verify this patch? |
| }, | ||
| "INVALID_ELEMENT_TYPE" : { | ||
| "message" : [ | ||
| "Input to function <functionName> cannot contain elements of <elementType>. <message>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's don't pass message, and introduce more specific error class which includes the message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
| }, | ||
| "HASH_MAP_TYPE" : { | ||
| "message" : [ | ||
| "Input to function <functionName> cannot contain elements of MAP. In Spark, same maps may have different hashcode, thus hash expressions are prohibited on MapType elements. To restore previous behavior set \"spark.sql.legacy.allowHashOnMapType\" to \"true\".", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "Input to function <functionName> cannot contain elements of MAP. In Spark, same maps may have different hashcode, thus hash expressions are prohibited on MapType elements. To restore previous behavior set \"spark.sql.legacy.allowHashOnMapType\" to \"true\".", | |
| "Input to the function <functionName> cannot contain elements of the \"MAP\" type. In Spark, same maps may have different hashcode, thus hash expressions are prohibited on \"MAP\" elements. To restore previous behavior set \"spark.sql.legacy.allowHashOnMapType\" to \"true\".", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
| DataTypeMismatch( | ||
| errorSubClass = "WRONG_NUM_PARAMS", | ||
| messageParameters = Map( | ||
| "functionName" -> prettyName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, quote the function id by toSQLId()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| "to true.") | ||
| DataTypeMismatch( | ||
| errorSubClass = "HASH_MAP_TYPE", | ||
| messageParameters = Map("functionName" -> prettyName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote by toSQLId()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
MaxGekk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for CI.
|
+1, LGTM. Merging to master. |
…to error classes ### What changes were proposed in this pull request? This pr replaces TypeCheckFailure by DataTypeMismatch in type checks in the math expressions, includes: - hash.scala (HashExpression) - mathExpressions.scala (RoundBase) ### Why are the changes needed? Migration onto error classes unifies Spark SQL error messages. ### Does this PR introduce _any_ user-facing change? Yes. The PR changes user-facing error messages. ### How was this patch tested? - Add new UT - Update existed UT - Pass GA. Closes apache#38332 from panbingkun/SPARK-40750. Authored-by: panbingkun <pbk1982@gmail.com> Signed-off-by: Max Gekk <max.gekk@gmail.com>
What changes were proposed in this pull request?
This pr replaces TypeCheckFailure by DataTypeMismatch in type checks in the math expressions, includes:
Why are the changes needed?
Migration onto error classes unifies Spark SQL error messages.
Does this PR introduce any user-facing change?
Yes. The PR changes user-facing error messages.
How was this patch tested?