[ 
https://issues.apache.org/jira/browse/SPARK-56611?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mervyn Lobo updated SPARK-56611:
--------------------------------
    Description: 
h3. Problem

{{ALTER TABLE ... RENAME TO}} fails in these cases:
 * Catalog-qualified targets in V2 (catalog incorrectly treated as namespace)
 * Table-only targets (namespace not inherited from source)

Example:

{{ALTER TABLE testcat.ns.t1 RENAME TO testcat.ns.t2;}}

 

Produces incorrect identifier:

{{Identifier.of(["testcat", "ns"], "t2")}}

Expected:

{{Identifier.of(["ns"], "t2")}}
h3. Expected behaviour
 * Strip catalog when it matches source

 * Inherit source namespace for table-only targets

 * Reject cross-namespace renames

h3. To Reproduce

{{CREATE TABLE testcat.ns.t1 USING foo AS SELECT 1 AS id;}}

{{{{}}{}}}{{{}ALTER TABLE testcat.ns.t1 RENAME TO testcat.ns.t2;{}}}{{{{}}{}}}

 

  was:
h3. Problem{{{}{}}}

{{ALTER TABLE ... RENAME TO}} fails in these cases:
 * Catalog-qualified targets in V2 (catalog incorrectly treated as namespace)
 * Table-only targets (namespace not inherited from source)

Example:

{{ALTER TABLE testcat.ns.t1 RENAME TO testcat.ns.t2;}}

 

Produces incorrect identifier:

{{Identifier.of(["testcat", "ns"], "t2")}}

Expected:

{{Identifier.of(["ns"], "t2")}}
h3. Expected behaviour
 * Strip catalog when it matches source

 * Inherit source namespace for table-only targets

 * Reject cross-namespace renames

h3. To Reproduce

{{CREATE TABLE testcat.ns.t1 USING foo AS SELECT 1 AS id;}}

{{{}{}}}{{{}ALTER TABLE testcat.ns.t1 RENAME TO testcat.ns.t2;{}}}{{{}{}}}

 


> ALTER TABLE RENAME TO fails with catalog-qualified or table-only target 
> identifiers
> -----------------------------------------------------------------------------------
>
>                 Key: SPARK-56611
>                 URL: https://issues.apache.org/jira/browse/SPARK-56611
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 4.1.1
>            Reporter: Mervyn Lobo
>            Priority: Major
>
> h3. Problem
> {{ALTER TABLE ... RENAME TO}} fails in these cases:
>  * Catalog-qualified targets in V2 (catalog incorrectly treated as namespace)
>  * Table-only targets (namespace not inherited from source)
> Example:
> {{ALTER TABLE testcat.ns.t1 RENAME TO testcat.ns.t2;}}
>  
> Produces incorrect identifier:
> {{Identifier.of(["testcat", "ns"], "t2")}}
> Expected:
> {{Identifier.of(["ns"], "t2")}}
> h3. Expected behaviour
>  * Strip catalog when it matches source
>  * Inherit source namespace for table-only targets
>  * Reject cross-namespace renames
> h3. To Reproduce
> {{CREATE TABLE testcat.ns.t1 USING foo AS SELECT 1 AS id;}}
> {{{{}}{}}}{{{}ALTER TABLE testcat.ns.t1 RENAME TO testcat.ns.t2;{}}}{{{{}}{}}}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to