-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-28970][SQL] Implement USE CATALOG/NAMESPACE for Data Source V2 #25771
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 12 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
d956f10
initial checkin
imback82 826c148
add rules
imback82 eda2d9d
Merge branch 'master' into use_namespace + more feature work
imback82 3faebcf
more changes
imback82 b1b59fc
adding more unit tests
imback82 f8b3058
minor cleanups
imback82 081fdb3
Merge branch 'master' into use_namespace
imback82 0d5246d
update docs/sql-keywords.md
imback82 680b16d
Merge branch 'master' into use_namespace
imback82 12685e0
Address PR comments (introduce BaseSessionCatalog)
imback82 ad08096
Fix tests
imback82 1fb5751
Fix java style check failures.
imback82 45d4cf1
Address PR comments
imback82 55d7d46
Merge branch 'master' into use_namespace
imback82 4d2865c
Address PR comments
imback82 467a8fa
Update CATALOG keyword info.
imback82 2dbf689
Pass in CatalogManager to Optmimizer instead of SessionCatalog: fixes…
imback82 86b6c79
Address PR comments. Fix hive-thriftserver tests.
imback82 f87247e
Add a test for session catalog.
imback82 8c5a337
Merge branch 'master' into use_namespace
imback82 e6e71a9
Fix build error + check namespace existence.
imback82 401f275
Fix failing tests
imback82 f252bec
Merge branch 'master' into use_namespace
imback82 30a0f7a
Fix hive tests
imback82 110f6bf
Fix GetCurrentDatabase to use namespace.quoted
imback82 341d8d2
Address PR comments
imback82 a1b6d72
Fix formatting
imback82 d42d72a
Fix compile errors
imback82 c192710
Merge branch 'master' into use_namespace
imback82 1579f97
Fix unit tests
imback82 b7c1e79
Fix sql tests
imback82 0bceddb
address PR comments
imback82 b33060b
Simplify USE parsing.
imback82 2534baf
Retain existing formatting
imback82 3f2e1c1
Address PR comments
imback82 57f05fd
Merge branch 'master' into use_namespace
imback82 88872ea
formatting
imback82 8485619
Reverting back GlobalTempView test since namespace check is not requi…
imback82 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,7 +82,9 @@ singleTableSchema | |
| statement | ||
| : query #statementDefault | ||
| | ctes? dmlStatementNoWith #dmlStatement | ||
| | USE db=errorCapturingIdentifier #use | ||
| | USE CATALOG catalog=errorCapturingIdentifier #useCatalog | ||
| | USE namespace=multipartIdentifier | ||
|
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.
Contributor
Author
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. +1. yea I think that will be useful. |
||
| (IN catalog=errorCapturingIdentifier)? #use | ||
| | CREATE database (IF NOT EXISTS)? db=errorCapturingIdentifier | ||
| ((COMMENT comment=STRING) | | ||
| locationSpec | | ||
|
|
@@ -1399,6 +1401,7 @@ CACHE: 'CACHE'; | |
| CASCADE: 'CASCADE'; | ||
| CASE: 'CASE'; | ||
| CAST: 'CAST'; | ||
| CATALOG: 'CATALOG'; | ||
|
imback82 marked this conversation as resolved.
Outdated
|
||
| CHANGE: 'CHANGE'; | ||
| CHECK: 'CHECK'; | ||
| CLEAR: 'CLEAR'; | ||
|
|
||
28 changes: 28 additions & 0 deletions
28
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/BaseSessionCatalog.java
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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.spark.sql.connector.catalog; | ||
|
|
||
| import org.apache.spark.annotation.Experimental; | ||
|
|
||
| /** | ||
| * An interface that aggregates different catalog interfaces that can be supported | ||
| * by a session catalog. | ||
| */ | ||
| @Experimental | ||
| public interface BaseSessionCatalog extends TableCatalog, SupportsNamespaces { | ||
|
imback82 marked this conversation as resolved.
Outdated
|
||
| } | ||
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
28 changes: 28 additions & 0 deletions
28
...ala/org/apache/spark/sql/catalyst/plans/logical/sql/UseCatalogAndNamespaceStatement.scala
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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.spark.sql.catalyst.plans.logical.sql | ||
|
|
||
| /** | ||
| * A USE/USE CATALOG statement, as parsed from SQL. | ||
| */ | ||
| case class UseCatalogAndNamespaceStatement( | ||
|
imback82 marked this conversation as resolved.
Outdated
|
||
| catalogName: Option[String], | ||
| namespace: Option[Seq[String]]) | ||
| extends ParsedStatement { | ||
| require(catalogName.nonEmpty || namespace.nonEmpty) | ||
| } | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.