-
- Downloads
[SPARK-17910][SQL] Allow users to update the comment of a column
## What changes were proposed in this pull request? Right now, once a user set the comment of a column with create table command, he/she cannot update the comment. It will be useful to provide a public interface (e.g. SQL) to do that. This PR implements the following SQL statement: ``` ALTER TABLE table [PARTITION partition_spec] CHANGE [COLUMN] column_old_name column_new_name column_dataType [COMMENT column_comment] [FIRST | AFTER column_name]; ``` For further expansion, we could support alter `name`/`dataType`/`index` of a column too. ## How was this patch tested? Add new test cases in `ExternalCatalogSuite` and `SessionCatalogSuite`. Add sql file test for `ALTER TABLE CHANGE COLUMN` statement. Author: jiangxingbo <jiangxb1987@gmail.com> Closes #15717 from jiangxb1987/change-column.
Showing
- sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 8 additions, 2 deletions...in/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
- sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala 28 additions, 1 deletion...scala/org/apache/spark/sql/execution/SparkSqlParser.scala
- sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala 71 additions, 0 deletions...in/scala/org/apache/spark/sql/execution/command/ddl.scala
- sql/core/src/test/resources/sql-tests/inputs/change-column.sql 55 additions, 0 deletions...ore/src/test/resources/sql-tests/inputs/change-column.sql
- sql/core/src/test/resources/sql-tests/results/change-column.sql.out 306 additions, 0 deletions...rc/test/resources/sql-tests/results/change-column.sql.out
- sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLCommandSuite.scala 29 additions, 14 deletions.../apache/spark/sql/execution/command/DDLCommandSuite.scala
- sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala 32 additions, 1 deletion...ala/org/apache/spark/sql/execution/command/DDLSuite.scala
Loading
Please register or sign in to comment