Impala Public Jenkins has submitted this change and it was merged. Change subject: IMPALA-4622: Add ALTER COLUMN statement. ......................................................................
IMPALA-4622: Add ALTER COLUMN statement. Kudu recently added the ability to alter a column's default value and storage attributes (KUDU-861). This patch adds the ability to modify these from Impala using ALTER. It also supports altering a column's comment for non-Kudu tables. It does not support setting a column to be a primary key or changing a column's nullability, because those are not supported on the Kudu side yet. Syntax: ALTER TABLE <table> ALTER [COLUMN] <column> SET <attr> <value> [<attr> <value> [<attr> <value>...]] where <attr> is one of: - DEFAULT, BLOCK_SIZE, ENCODING, COMPRESSION (Kudu tables) - COMMENT (non-Kudu tables) ALTER TABLE <table> ALTER [COLUMN] <column> DROP DEFAULT This is similar to the existing CHANGE statement: ALTER TABLE <table> CHANGE <column> <new_col_name> <type> [COMMENT <comment>] but the new syntax is more natural for setting column properties when the column name and type are not being changed. Both ALTER COLUMN and CHANGE COLUMN operations use AlterTableAlterColStmt and are sent to the catalog as ALTER_COLUMN operations. Testing: - Added FE tests to ParserTest and AnalyzeDDLTest - Added EE tests to test_kudu.py Change-Id: Id2e8bd65342b79644a0fdcd925e6f17797e89ad6 Reviewed-on: http://gerrit.cloudera.org:8080/6955 Reviewed-by: Thomas Tauber-Marshall <[email protected]> Tested-by: Impala Public Jenkins --- M common/thrift/JniCatalog.thrift M fe/src/main/cup/sql-parser.cup A fe/src/main/java/org/apache/impala/analysis/AlterTableAlterColStmt.java D fe/src/main/java/org/apache/impala/analysis/AlterTableChangeColStmt.java M fe/src/main/java/org/apache/impala/analysis/ColumnDef.java M fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java M fe/src/main/java/org/apache/impala/service/KuduCatalogOpExecutor.java M fe/src/test/java/org/apache/impala/analysis/AnalyzeDDLTest.java M fe/src/test/java/org/apache/impala/analysis/ParserTest.java M testdata/workloads/functional-query/queries/QueryTest/alter-table.test M testdata/workloads/functional-query/queries/QueryTest/kudu_alter.test M tests/query_test/test_kudu.py 12 files changed, 456 insertions(+), 147 deletions(-) Approvals: Impala Public Jenkins: Verified Thomas Tauber-Marshall: Looks good to me, approved -- To view, visit http://gerrit.cloudera.org:8080/6955 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id2e8bd65342b79644a0fdcd925e6f17797e89ad6 Gerrit-PatchSet: 11 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Thomas Tauber-Marshall <[email protected]> Gerrit-Reviewer: Alex Behm <[email protected]> Gerrit-Reviewer: Impala Public Jenkins Gerrit-Reviewer: Matthew Jacobs <[email protected]> Gerrit-Reviewer: Thomas Tauber-Marshall <[email protected]>
