GitHub user jiangxb1987 opened a pull request:

    https://github.com/apache/spark/pull/20696

    [SPARK-23525] [SQL] Support ALTER TABLE CHANGE COLUMN COMMENT for external 
hive table

    ## What changes were proposed in this pull request?
    
    The following query doesn't work as expected:
    ```
    CREATE EXTERNAL TABLE ext_table(a STRING, b INT, c STRING) PARTITIONED BY 
(d STRING)
    LOCATION 'sql/core/spark-warehouse/ext_table';
    ALTER TABLE ext_table CHANGE a a STRING COMMENT "new comment";
    DESC ext_table;
    ```
    The comment of column `a` is not updated, that's because 
`HiveExternalCatalog.doAlterTable` ignores table schema changes. To fix the 
issue, we should call `doAlterTableDataSchema` instead of `doAlterTable`.
    
    ## How was this patch tested?
    
    Updated `DDLSuite.testChangeColumn`.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jiangxb1987/spark alterColumnComment

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/20696.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #20696
    
----
commit 92b2f317aca1c8fe96e4448c8d6dcedce02c9429
Author: Xingbo Jiang <xingbo.jiang@...>
Date:   2018-02-28T15:29:19Z

    support change column comment for external hive table

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to