You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Terry Kim (Jira)" <ji...@apache.org> on 2019/12/02 03:55:00 UTC
[jira] [Commented] (SPARK-30094) Current namespace is not used
during table resolution
[ https://issues.apache.org/jira/browse/SPARK-30094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16985807#comment-16985807 ]
Terry Kim commented on SPARK-30094:
-----------------------------------
[~cloud_fan] this seems to be an unexpected behavior right?
> 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
> Priority: Major
>
> 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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org