Repository: incubator-impala Updated Branches: refs/heads/master f2580acba -> 9eb0b11a6
IMPALA-4616: [DOCS] Doc new ALTER TABLE options for Kudu I added the syntax and examples under ALTER TABLE, and also amended the wording in the list of ALTER TABLE restrictions to reflect the lifting of some restrictions. I didn't have detailed discussion of ALTER TABLE in the impala_kudu.xml page, so I didn't make any changes there. Change-Id: I5f87155dcba860f6fd9259387fea52bbe439e028 Reviewed-on: http://gerrit.cloudera.org:8080/7041 Reviewed-by: Matthew Jacobs <[email protected]> Tested-by: Impala Public Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/9eb0b11a Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/9eb0b11a Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/9eb0b11a Branch: refs/heads/master Commit: 9eb0b11a6dbf21948ea65f918b9c29c7f58d7571 Parents: f2580ac Author: John Russell <[email protected]> Authored: Thu Jun 1 00:26:15 2017 -0700 Committer: Impala Public Jenkins <[email protected]> Committed: Thu Jun 1 18:13:46 2017 +0000 ---------------------------------------------------------------------- docs/topics/impala_alter_table.xml | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/9eb0b11a/docs/topics/impala_alter_table.xml ---------------------------------------------------------------------- diff --git a/docs/topics/impala_alter_table.xml b/docs/topics/impala_alter_table.xml index 5c94303..e12e1b8 100644 --- a/docs/topics/impala_alter_table.xml +++ b/docs/topics/impala_alter_table.xml @@ -87,7 +87,10 @@ statsKey ::= numDVs | numNulls | avgSize | maxSize</ph> <varname>new_name</varname> ::= [<varname>new_database</varname>.]<varname>new_table_name</varname> -<varname>col_spec</varname> ::= <varname>col_name</varname> <varname>type_name</varname> +<varname>col_spec</varname> ::= <varname>col_name</varname> <varname>type_name</varname> <ph rev="2.9.0 IMPALA-4616">[<varname>kudu_attributes</varname>]</ph> + +<ph rev="2.9.0 IMPALA-4616"><varname>kudu_attributes</varname> ::= { [NOT] NULL | ENCODING <varname>codec</varname> | COMPRESSION <varname>algorithm</varname> | + DEFAULT <varname>constant</varname> | BLOCK_SIZE <varname>number</varname> }</ph> <varname>partition_spec</varname> ::= <varname>simple_partition_spec</varname> | <ph rev="IMPALA-1654"><varname>complex_partition_spec</varname></ph> @@ -920,6 +923,12 @@ alter table sales_data add partition (zipcode = cast(9021 * 10 as string));</cod </p> </li> <li> + <p rev="2.9.0 IMPALA-4616"> + In <keyword keyref="impala29_full"/> and higher, you can also specify the <codeph>ENCODING</codeph>, + <codeph>COMPRESSION</codeph>, and <codeph>BLOCK_SIZE</codeph> attributes when adding a column. + </p> + </li> + <li> <p> If you add a column with a <codeph>NOT NULL</codeph> attribute, it must also have a <codeph>DEFAULT</codeph> attribute, so the default value can be assigned to that @@ -940,12 +949,6 @@ alter table sales_data add partition (zipcode = cast(9021 * 10 as string));</cod </li> <li> <p> - You cannot assign the <codeph>ENCODING</codeph>, <codeph>COMPRESSION</codeph>, - or <codeph>BLOCK_SIZE</codeph> attributes when adding a column. - </p> - </li> - <li> - <p> You cannot change the default value, nullability, encoding, compression, or block size of existing columns in a Kudu table. </p> @@ -967,6 +970,20 @@ alter table sales_data add partition (zipcode = cast(9021 * 10 as string));</cod </ul> </p> + <p> + The following are some examples of using the <codeph>ADD COLUMNS</codeph> clause for a Kudu table: + </p> + +<codeblock rev="2.9.0 IMPALA-4616"> +CREATE TABLE t1 ( x INT, PRIMARY KEY (x) ) + PARTITION BY HASH (x) PARTITIONS 16 + STORED AS KUDU + +ALTER TABLE t1 ADD COLUMNS (y STRING ENCODING prefix_encoding); +ALTER TABLE t1 ADD COLUMNS (z INT DEFAULT 10); +ALTER TABLE t1 ADD COLUMNS (a STRING NOT NULL DEFAULT '', t TIMESTAMP COMPRESSION default_compression); +</codeblock> + <p rev="kudu"> Kudu tables all use an underlying partitioning mechanism. The partition syntax is different than for non-Kudu tables. You can use the <codeph>ALTER TABLE</codeph> statement to add and drop <term>range partitions</term>
