-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-31100][SQL] Check namespace existens when setting namespace #27900
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
Change-Id: Ibbb3eff4e56d5cf725ebce1e35445bc1155d8d90
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogManager.scala
Outdated
Show resolved
Hide resolved
|
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
|
how about this: we check namespace existence if the catalog implements |
Ah, that's a better idea. |
…mespaces Change-Id: I8eb09649a8ce294c257bcba1313f89dfe57c912f
|
ok to test |
| assert(v1SessionCatalog.getCurrentDatabase == "default") | ||
|
|
||
| // Check namespace existence if currentCatalog implements SupportsNamespaces. | ||
| conf.setConfString("spark.sql.catalog.dummyNamespace", classOf[DummyNameSpaceCatalog].getName) |
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.
We can reuse InMemoryTableCatalog and create some namespaces before testing setCurrentNamespace
Change-Id: I934a73eeba768abe3dd20d06edcb4931c89dd54e
|
Test build #124796 has finished for PR 27900 at commit
|
cloud-fan
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.
LGTM. This behavior is also consistent with the v1 session catalog.
|
cc @rdblue |
|
Sounds good to me. +1 |
|
Test build #124787 has finished for PR 27900 at commit
|
|
Test build #5050 has finished for PR 27900 at commit
|
Change-Id: I77526c816650e368092e882e202e4a537a5b4720
|
@cloud-fan @rdblue can we reset build? |
| assert(exception.getMessage.contains("Database 'ns1' not found")) | ||
| } | ||
|
|
||
| test("Use: v2 catalog is used and namespace does not exist") { |
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.
we should update this test with catalogs that don't implement SupportsNamespace
|
|
||
| sql("USE testcat") | ||
| testShowCurrentNamespace("testcat", "") | ||
| sql("create namespace testcat.ns1.ns2") |
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 upper case the SQL keywords
| spark.conf.unset(V2_SESSION_CATALOG_IMPLEMENTATION.key) | ||
| val sessionCatalogName = CatalogManager.SESSION_CATALOG_NAME | ||
|
|
||
| sql("create namespace testcat.ns1.ns2") |
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
Change-Id: I3f7a2440621747024ec239a23c014a716b9f7bec
|
Test build #124832 has finished for PR 27900 at commit
|
|
Test build #124863 has finished for PR 27900 at commit
|
|
retest this please |
|
Test build #124880 has finished for PR 27900 at commit
|
|
thanks, merging to master! |
What changes were proposed in this pull request?
Check the namespace existence while calling "use namespace", and throw NoSuchNamespaceException if namespace not exists.
Why are the changes needed?
Users need to know that the namespace does not exist when they try to set a wrong namespace.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Run all suites and add a test for this