forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-30094][SQL] Apply current namespace for the single-part table …
…name ### What changes were proposed in this pull request? This PR applies the current namespace for the single-part table name if the current catalog is a non-session catalog. Note that the reason the current namespace is not applied for the session catalog is that the single-part name could be referencing a temp view which doesn't belong to any namespaces. The empty namespace for a table inside the session catalog is resolved by the session catalog implementation. ### Why are the changes needed? It's fixing the following bug where the current namespace is not respected: ``` sql("CREATE TABLE testcat.ns.t USING foo AS SELECT 1 AS id") sql("USE testcat.ns") sql("SHOW CURRENT NAMESPACE").show +-------+---------+ |catalog|namespace| +-------+---------+ |testcat| ns| +-------+---------+ // `t` is not resolved since the current namespace `ns` is not used. sql("DESCRIBE t").show Failed to analyze query: org.apache.spark.sql.AnalysisException: Table not found: t;; ``` ### Does this PR introduce any user-facing change? Yes, the above `DESCRIBE` command will succeed. ### How was this patch tested? Added tests. Closes apache#26894 from imback82/current_namespace. Authored-by: Terry Kim <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
- Loading branch information
Showing
6 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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