Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> Please HELP: HIVE alter table add new partition to schema...


Copy link to this message
-
Re: Please HELP: HIVE alter table add new partition to schema...
You can not change the partition columns. I would use a dynamic
partition insert to select all the data from the original table into
the new table.

On 6/19/12, Tim Havens <[EMAIL PROTECTED]> wrote:
> So...I have a table that has thousands of files, and Billions of rows
> related it.
>
> Lets make this a simple table:
>
> CREATE TABLE test_table (
>     ts BIGINT,
>     exec_time DOUBLE,
>     domain_id BIGINT,
>     domain_name STRING,
> )
> PARTITIONED BY (logdate STRING, source STRING, datacenter STRING,
> hostname STRING)
> ROW FORMAT DELIMITED
> FIELDS TERMINATED BY '\t'
> COLLECTION ITEMS TERMINATED BY '\001'
> MAP KEYS TERMINATED BY '\002'
> LINES TERMINATED BY '\n'
> STORED AS TextFile;
>
> So...what I need to do is ADD a partition to the PARTITIONED BY spec
> above....
>
> The partitioned by column I want to add is 'loghour STRING'.
>
> I can't seem to find any way to accomplish actually adding a NEW
> PARTITION COLUMN in the 'PARTITIONED BY' spec, without completely
> recreating and reloading the table.
>
> What's the correct way of adding to the partition schema and new
> column like 'loghour STRING'.
>
> I'm not trying to add an entry into the table DATA, I'm trying to add
> a completely new PARTITIONED BY Column...
>