-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[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
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d49d1c1
[SPARK-40810][SQL] Use SparkIllegalArgumentException instead of Illeg…
panbingkun f806532
[SPARK-40810][SQL] Use SparkIllegalArgumentException instead of Illeg…
panbingkun ca6103d
[SPARK-40810][SQL] Use SparkIllegalArgumentException instead of Illeg…
panbingkun c52c324
SPARK-40810][SQL] Use SparkIllegalArgumentException instead of Illega…
panbingkun fe4be4d
[SPARK-40810][SQL] Use SparkIllegalArgumentException instead of Illeg…
panbingkun 09da9ef
[SPARK-40810][SQL] Use SparkIllegalArgumentException instead of Illeg…
panbingkun 6389684
[SPARK-40810][SQL] Use SparkIllegalArgumentException instead of Illeg…
panbingkun 170d8f6
[SPARK-40810][SQL] Use SparkIllegalArgumentException instead of Illeg…
panbingkun 3482b39
[SPARK-40810][SQL] Use SparkIllegalArgumentException instead of Illeg…
panbingkun 104c1f3
[SPARK-40810][SQL] Use SparkIllegalArgumentException instead of Illeg…
panbingkun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
|
|
||
| package org.apache.spark.sql.execution.command | ||
|
|
||
| import org.apache.spark.SparkIllegalArgumentException | ||
| import org.apache.spark.sql.{AnalysisException, QueryTest} | ||
| import org.apache.spark.sql.connector.catalog.SupportsNamespaces | ||
|
|
||
|
|
@@ -45,10 +46,13 @@ trait AlterNamespaceSetLocationSuiteBase extends QueryTest with DDLCommandTestUt | |
| val ns = s"$catalog.$namespace" | ||
| withNamespace(ns) { | ||
| sql(s"CREATE NAMESPACE $ns") | ||
| val message = intercept[IllegalArgumentException] { | ||
| 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 ''" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| checkError( | ||
| exception = intercept[SparkIllegalArgumentException] { | ||
| sql(sqlText) | ||
| }, | ||
| errorClass = "UNSUPPORTED_EMPTY_LOCATION", | ||
| parameters = Map.empty) | ||
| } | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ import scala.collection.JavaConverters._ | |
|
|
||
| import org.apache.hadoop.fs.Path | ||
|
|
||
| import org.apache.spark.SparkIllegalArgumentException | ||
| import org.apache.spark.sql.QueryTest | ||
| import org.apache.spark.sql.catalyst.analysis.NamespaceAlreadyExistsException | ||
| import org.apache.spark.sql.catalyst.parser.ParseException | ||
|
|
@@ -67,15 +68,15 @@ trait CreateNamespaceSuiteBase extends QueryTest with DDLCommandTestUtils { | |
| // The generated temp path is not qualified. | ||
| val path = tmpDir.getCanonicalPath | ||
| assert(!path.startsWith("file:/")) | ||
|
|
||
| val e = intercept[IllegalArgumentException] { | ||
| sql(s"CREATE NAMESPACE $ns LOCATION ''") | ||
| } | ||
| assert(e.getMessage.contains("Can not create a Path from an empty string")) | ||
|
|
||
| val sqlText = s"CREATE NAMESPACE $ns LOCATION ''" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
| checkError( | ||
| exception = intercept[SparkIllegalArgumentException] { | ||
| sql(sqlText) | ||
| }, | ||
| errorClass = "UNSUPPORTED_EMPTY_LOCATION", | ||
| parameters = Map.empty) | ||
| val uri = new Path(path).toUri | ||
| sql(s"CREATE NAMESPACE $ns LOCATION '$uri'") | ||
|
|
||
| // Make sure the location is qualified. | ||
| val expected = makeQualifiedPath(tmpDir.toString) | ||
| assert("file" === expected.getScheme) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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.