-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-40810][SQL] Use SparkIllegalArgumentException instead of IllegalArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand #38274
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
…alArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand
…alArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand
…alArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand
…lArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand
|
cc @MaxGekk |
| val e = intercept[SparkIllegalArgumentException] { | ||
| sql(s"CREATE NAMESPACE $ns LOCATION ''") | ||
| } | ||
| assert(e.getMessage.contains("Can not create a Path from an empty string")) | ||
| assert(e.getMessage.contains("Unsupported empty location")) |
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.
As you are here, could you use checkError().
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.
|
Can one of the admins verify this patch? |
…alArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand
…alArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand
…alArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand
…alArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand
…alArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand
| "Not enough memory to build and broadcast the table to all worker nodes. As a workaround, you can either disable broadcast by setting <autoBroadcastjoinThreshold> to -1 or increase the spark driver memory by setting <driverMemory> to a higher value<analyzeTblMsg>" | ||
| ] | ||
| }, | ||
| "_LEGACY_ERROR_TEMP_2251" : { |
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.
Could you assign a name to the error class like: UNSUPPORTED_EMPTY_LOCATION
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
…alArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand
|
+1, LGTM. Merging to master. |
| }, | ||
| "UNSUPPORTED_EMPTY_LOCATION" : { | ||
| "message" : [ | ||
| "Unsupported empty location." |
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.
empty location is a bit misleading. This is not a location with no files/directories, it's empty string. How about
EMPTY_STRING_AS_LOCATION: Can not reference a location with an empty string.
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.
@panbingkun Could you open a follow up PR and change this, and address below comment, please.
| sql(s"ALTER NAMESPACE $ns SET LOCATION ''") | ||
| }.getMessage | ||
| assert(message.contains("Can not create a Path from an empty string")) | ||
| val sqlText = s"ALTER NAMESPACE $ns SET LOCATION ''" |
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.
I think we can move this test to the base suite now, as the behavior is consistent between v1 and v2 tables.
| } | ||
| assert(e.getMessage.contains("Can not create a Path from an empty string")) | ||
|
|
||
| val sqlText = s"CREATE NAMESPACE $ns LOCATION ''" |
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.
ditto
…alArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand ### What changes were proposed in this pull request? This pr aims to use SparkIllegalArgumentException instead of IllegalArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand. ### Why are the changes needed? When I work on https://issues.apache.org/jira/browse/SPARK-40790, I found when `location` is empty, DDL command(CreateDatabaseCommand & AlterDatabaseSetLocationCommand) throw IllegalArgumentException, it seem not to fit into the new error framework. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Existed UT. Closes apache#38274 from panbingkun/setNamespaceLocation_error. Authored-by: panbingkun <[email protected]> Signed-off-by: Max Gekk <[email protected]>
What changes were proposed in this pull request?
This pr aims to use SparkIllegalArgumentException instead of IllegalArgumentException in CreateDatabaseCommand & AlterDatabaseSetLocationCommand.
Why are the changes needed?
When I work on https://issues.apache.org/jira/browse/SPARK-40790,
I found when
locationis empty, DDL command(CreateDatabaseCommand & AlterDatabaseSetLocationCommand) throw IllegalArgumentException, it seem not to fit into the new error framework.Does this PR introduce any user-facing change?
No.
How was this patch tested?
Existed UT.