hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Hadoop Wiki] Update of "Hive/LanguageManual/DDL" by PhiloVivero
Date Tue, 03 May 2011 23:39:45 GMT
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 PhiloVivero.
The comment on this change is: Broken partition_spec example caused me days of grief. Trying
to make sure no-one else has to suffer this pain..


  You can use ALTER TABLE ADD PARTITION to add partitions to a table.  Partition values should
be quoted only if they are strings. The location must be a directory inside of which data
files reside.
+ Note that it is proper syntax to have multiple partition_spec in a single ALTER TABLE, but
if you do this in version 0.7, your partitioning scheme will fail. That is, every query specifying
a partition will always use only the first partition. Instead, you should use the following
form if you want to add many partitions:
+ {{{
+ ALTER TABLE table_name ADD PARTITION (partCol = 'value1') location 'loc1';
+ ALTER TABLE table_name ADD PARTITION (partCol = 'value2') location 'loc2';
+ ...
+ ALTER TABLE table_name ADD PARTITION (partCol = 'valueN') location 'locN';
+ }}}
+ Specifically, the following example (which was the default example before) will FAIL silently
and without error, and all queries will go only to dt='2008-08-08' partition, no matter which
partition you specify.
  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 ===

View raw message