You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by we...@apache.org on 2021/02/19 04:48:45 UTC

[spark] branch master updated: [SPARK-34466][SQL][DOCS] Improve docs for `ALTER TABLE .. RENAME TO`

This is an automated email from the ASF dual-hosted git repository.

wenchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 4a9a1d4  [SPARK-34466][SQL][DOCS] Improve docs for `ALTER TABLE .. RENAME TO`
4a9a1d4 is described below

commit 4a9a1d42e7bc3120fc114393e524deb1b16f7419
Author: Max Gekk <ma...@gmail.com>
AuthorDate: Fri Feb 19 04:48:16 2021 +0000

    [SPARK-34466][SQL][DOCS] Improve docs for `ALTER TABLE .. RENAME TO`
    
    ### What changes were proposed in this pull request?
    Explicitly highlight that the table rename command cannot move a table between databases.
    
    ### Why are the changes needed?
    To inform users about actual behavior of the table rename command.
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    ```sql
    spark-sql> CREATE DATABASE db1;
    spark-sql> CREATE DATABASE db2;
    spark-sql> CREATE TABLE db1.tbl1 (c0 INT);
    spark-sql> ALTER TABLE db1.tbl1 RENAME TO db2.tbl1;
    Error in query: RENAME TABLE source and destination databases do not match: 'db1' != 'db2';
    spark-sql> ALTER TABLE db1.tbl1 RENAME TO db1.tbl2;
    spark-sql> SHOW TABLES IN db1 LIKE '*';
    db1	tbl2	false
    ```
    
    Closes #31586 from MaxGekk/doc-rename-table.
    
    Authored-by: Max Gekk <ma...@gmail.com>
    Signed-off-by: Wenchen Fan <we...@databricks.com>
---
 docs/sql-ref-syntax-ddl-alter-table.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/sql-ref-syntax-ddl-alter-table.md b/docs/sql-ref-syntax-ddl-alter-table.md
index eb0e9a9..e4d73f3 100644
--- a/docs/sql-ref-syntax-ddl-alter-table.md
+++ b/docs/sql-ref-syntax-ddl-alter-table.md
@@ -25,7 +25,7 @@ license: |
 
 ### RENAME 
 
-`ALTER TABLE RENAME TO` statement changes the table name of an existing table in the database.
+`ALTER TABLE RENAME TO` statement changes the table name of an existing table in the database. The table rename command cannot be used to move a table between databases, only to rename a table within the same database.
 
 #### Syntax
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org