You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by Apache Wiki <wi...@apache.org> on 2010/10/13 23:44:32 UTC

[Hadoop Wiki] Update of "Hive/LanguageManual/DDL" by MichaelLewis

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 MichaelLewis.
The comment on this change is: It appears that IF NOT EXISTS is an undocumented feature of add partition, and actually quite useful..
http://wiki.apache.org/hadoop/Hive/LanguageManual/DDL?action=diff&rev1=71&rev2=72

--------------------------------------------------

  
  === Add Partitions ===
  {{{
- ALTER TABLE table_name ADD partition_spec [ LOCATION 'location1' ] partition_spec [ LOCATION 'location2' ] ...
+ ALTER TABLE table_name ADD [IF NOT EXISTS] partition_spec [ LOCATION 'location1' ] partition_spec [ LOCATION 'location2' ] ...
  
  partition_spec:
    : PARTITION (partition_col = partition_col_value, partition_col = partiton_col_value, ...)
@@ -187, +187 @@

  {{{
  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';
  }}}
+ 
+ An error is thrown if the partition_spec for the table already exists. You can use IF NOT EXISTS to skip the error.
+ 
  === Drop Partitions ===
  {{{
  ALTER TABLE table_name DROP partition_spec, partition_spec,...