[
https://issues.apache.org/jira/browse/SPARK-30094?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wenchen Fan resolved SPARK-30094.
---------------------------------
Fix Version/s: 3.0.0
Resolution: Fixed
Issue resolved by pull request 26894
[https://github.com/apache/spark/pull/26894]
> Current namespace is not used during table resolution
> -----------------------------------------------------
>
> Key: SPARK-30094
> URL: https://issues.apache.org/jira/browse/SPARK-30094
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 3.0.0
> Reporter: Terry Kim
> Assignee: Terry Kim
> Priority: Major
> Fix For: 3.0.0
>
>
> The following example shows the scenario where the current namespace is not
> respected:
> {code:java}
> sql("CREATE TABLE testcat.t USING foo AS SELECT 1 AS id")
> sql("USE testcat")
> sql("SHOW CURRENT NAMESPACE").show
> +-------+---------+
> |catalog|namespace|
> +-------+---------+
> |testcat| |
> +-------+---------+
> // `t` is resolved to `testcat.t`.
> sql("DESCRIBE t").show
> +---------------+---------+-------+
> | col_name|data_type|comment|
> +---------------+---------+-------+
> | id| int| |
> | | | |
> | # Partitioning| | |
> |Not partitioned| | |
> +---------------+---------+-------+
> // Now create a table under `ns` namespace.
> 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 any longer since the current namespace `ns` is not
> used.
> sql("DESCRIBE t").show
> org.apache.spark.sql.AnalysisException: Invalid command: 't' is a view not a
> table.; line 1 pos 0;
> 'DescribeTable 'UnresolvedV2Relation [t],
> org.apache.spark.sql.connector.InMemoryTableCatalog@2c5ead80, `t`, false
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]