You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Leo Alekseyev <dn...@gmail.com> on 2010/08/24 08:35:40 UTC

Adding partition to an existing table

Hi all,
Is it possible to add partitions to an existing table?..  Basically, I
have a table partitioned by date, but it should have another partition
field -- that is, the hdfs paths should look something like
/hdfs_location/my_table/ds=2010-08-23/chunk=0.  I've had no luck with
alter table add partition statement.  What I need is to incorporate
the new partition into the table schema, and make the existing table
conform to the new schema -- physically this means moving all the data
from the ../ds=DATE/ to ../ds=DATE/chunk=0/ for every date currently
in the table.  Is there an easy way to do so?..  Would be grateful for
any hints :)
--Leo

Re: Adding partition to an existing table

Posted by Alexey Kovyrin <al...@kovyrin.net>.
One possible option:
1) create new table withe structure you need
2) copy the data over
3) drop old table
4) rename the new one

On Tue, Aug 24, 2010 at 2:35 AM, Leo Alekseyev <dn...@gmail.com> wrote:
> Hi all,
> Is it possible to add partitions to an existing table?..  Basically, I
> have a table partitioned by date, but it should have another partition
> field -- that is, the hdfs paths should look something like
> /hdfs_location/my_table/ds=2010-08-23/chunk=0.  I've had no luck with
> alter table add partition statement.  What I need is to incorporate
> the new partition into the table schema, and make the existing table
> conform to the new schema -- physically this means moving all the data
> from the ../ds=DATE/ to ../ds=DATE/chunk=0/ for every date currently
> in the table.  Is there an easy way to do so?..  Would be grateful for
> any hints :)
> --Leo
>



-- 
Alexey Kovyrin
http://kovyrin.net/