spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jiangxb1987 <...@git.apache.org>
Subject [GitHub] spark pull request #20768: [BACKPORT] [SPARK-23525] [SQL] Support ALTER TABL...
Date Thu, 08 Mar 2018 02:56:57 GMT
GitHub user jiangxb1987 opened a pull request:

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

    [BACKPORT] [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 SPARK-23525-2.2

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

    https://github.com/apache/spark/pull/20768.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 #20768
    
----
commit 49038e6a7115b3a4c20d8360299d3b4531fa109b
Author: Xingbo Jiang <xingbo.jiang@...>
Date:   2018-03-07T21:51:44Z

    [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`.
    
    Author: Xingbo Jiang <xingbo.jiang@databricks.com>
    
    Closes #20696 from jiangxb1987/alterColumnComment.

----


---

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


Mime
View raw message