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 JohnSichi. http://wiki.apache.org/hadoop/Hive/LanguageManual/DDL?action=diff&rev1=34&rev2=35 -------------------------------------------------- When dropping an EXTERNAL table, data in the table will NOT be deleted from the file system. + See the next section on ALTER TABLE for how to drop partitions. + + + == Alter Table Statements == + Alter table statements enable you to change the structure of an existing table. You can add columns/partitions, change serde, add table and serde properties, or rename the table itself. + - === Drop Partitions === + === Add Partition === + {{{ - ALTER TABLE table_name DROP partition_spec, partition_spec,... + ALTER TABLE table_name ADD partition_spec [ LOCATION 'location1' ] partition_spec [ LOCATION 'location2' ] ... partition_spec: : PARTITION (partition_col = partition_col_value, partition_col = partiton_col_value, ...) }}} + + 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'; + }}} + + === Drop Partitions === + + {{{ + ALTER TABLE table_name DROP partition_spec, partition_spec,... + }}} + - You can use ALTER TABLE DROP PARTITION to drop a partition for a table. This removes the data and metadata for this partition. Partition value should be quoted only if it is a string. + 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 Statements == - Alter table statements enable you to change the structure of an existing table. You can add columns, change serde, add table and serde properties, or rename the table itself. === Rename Table === {{{
