Dear Wiki user, You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.
The "Hive/LanguageManual/DDL" page has been changed by PaulYang. http://wiki.apache.org/hadoop/Hive/LanguageManual/DDL?action=diff&rev1=48&rev2=49 -------------------------------------------------- You can use ALTER TABLE ADD PARTITION to add partitions to a table. Partition values should be quoted only if they are strings. {{{ - alter table page_view add partition (dt='2008-08-08', country='us') location '/path/to/us/part080808' partition (dt='2008-08-09', country='us') location '/path/to/us/part080809'; + ALTER TABLE page_view ADD PARTITION (dt='2008-08-08', country='us') location '/path/to/us/part080808' PARTITION (dt='2008-08-09', country='us') location '/path/to/us/part080809'; }}} === Drop Partitions === {{{ @@ -181, +181 @@ You can use ALTER TABLE DROP PARTITION to drop a partition for a table. This removes the data and metadata for this partition. {{{ - alter table page_view drop partition(dt='2008-08-08', country='us'); + ALTER TABLE page_view DROP PARTITION (dt='2008-08-08', country='us'); }}} === Rename Table === {{{ @@ -195, +195 @@ }}} This command will allow users to change a column's name, data type, comment, or position, or an arbitrary combination of them. - Example: create table test_change (a int, b int, c int); + Example: CREATE TABLE test_change (a int, b int, c int); - "alter table change a a1 int;" will change column a's name to a1. + "ALTER TABLE CHANGE a a1 INT;" will change column a's name to a1. - "alter table change a a1 string after b;" will change column a's name to a1, a's data type to string, and put it after column b. The new table's structure is: b int, a1 string, c int. + "ALTER TABLE CHANGE a a1 STRING AFTER b;" will change column a's name to a1, a's data type to string, and put it after column b. The new table's structure is: b int, a1 string, c int. - "alter table change b b1 int first;" will change column b's name to b1, and put it as the first column. The new table's structure is: b1 int, a string, c int. + "ALTER TABLE CHANGE b b1 INT FIRST;" will change column b's name to b1, and put it as the first column. The new table's structure is: b1 int, a string, c int. NOTE: The column change command will only modify Hive's metadata, and will NOT touch data. Users should make sure the actual data layout conforms with the metadata definition. @@ -234, +234 @@ === Alter Table File Format and Organization === {{{ - ALTER TABLE table_name SET FILE FORMAT file_format + ALTER TABLE table_name SET FILEFORMAT file_format ALTER TABLE table_name CLUSTERED BY (col_name, col_name, ...) [SORTED BY (col_name, ...)] INTO num_buckets BUCKETS }}} These statements change the table's physical storage properties. For available file_format options, see the section above on CREATE TABLE.