-Re: how to load data to partitioned table
bejoy_ks@... 2011-08-12, 13:58
Just having a look at your requirement , to load data into a partition based hive table from any input file the most hassle free approach would be.
1. Load the data into a non partitioned table that shares similar structure as the target table.
2. Populate the target table with the data from non partitioned one using hive dynamic partition
With Dynamic partitions you don't need to manually identify the data partitions and distribute data accordingly.
A similar implementation is described in the blog post
Hope it helps
Bejoy K S
From: Vikas Srivastava <[EMAIL PROTECTED]>
Date: Fri, 12 Aug 2011 17:31:28
To: <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: Re: how to load data to partitioned table
Simpley you have run query like this
FROM sales_temp INSERT OVERWRITE TABLE sales partition(period_key) SELECT *
2011/8/12 Daniel,Wu <[EMAIL PROTECTED]>
> suppose the table is partitioned by period_key, and the csv file also has
> a column named as period_key. The csv file contains multiple days of data,
> how can we load it in the the table?
> I think of an workaround by first load the data into a non-partition table,
> and then insert the data from non-partition table to the partition table.
> hive> INSERT OVERWRITE TABLE sales SELECT * FROM sales_temp;
> FAILED: Error in semantic analysis: need to specify partition columns
> because the destination table is partitioned.
> However it doesn't work also. please help.
DWH & Analytics Team
One97 | Let's get talking !