You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Rahul Channe <dr...@googlemail.com> on 2014/05/20 04:02:04 UTC
Unable to load data in hive table
I have created the following partitioned table in hive
create table custs ( cust_id int, first_name String,last_name
String,cust_age int ) partitioned by ( cust_prof String) row format
delimited fields terminated by ',';
when I am trying to load data into the table, I am getting error
load data local inpath './custs' into table custs partition(cust_prof);
FAILED: Error in semantic analysis:
org.apache.hadoop.hive.ql.metadata.HiveException: cust_prof not found in
table's partition spec: {cust_prof=null}
Re: Unable to load data in hive table
Posted by Szehon Ho <sz...@cloudera.com>.
Yea, it was just an example, as I didnt know your schema. Then you can do
(cust_prof='Pilot') or (cust_prof='Teacher'). Does that work for you?
On Tue, May 20, 2014 at 4:27 PM, Rahul Channe <dr...@googlemail.com>wrote:
> Hi Szehon,
>
> I have following records in my File, I want to load the cust table such a
> way that the records are partitioned based on profession
>
> 4000001,Kristina,Chung,55,Pilot
> 4000002,Paige,Chen,74,Teacher
> 4000003,Sherri,Melton,34,Firefighter
> 4000004,Gretchen,Hill,66,Computer hardware engineer
> 4000005,Karen,Puckett,74,Lawyer
> 4000006,Patrick,Song,42,Veterinarian
> 4000007,Elsie,Hamilton,43,Pilot
> 4000008,Hazel,Bender,63,Carpenter
> 4000009,Malcolm,Wagner,39,Artist
>
>
> The cust_prof values can be Pilot,Teacher etc.
>
> The command load data local inpath './custs' into table custs
> partition(cust_prof=1); doesnt work that way
>
>
> On Tue, May 20, 2014 at 2:24 PM, Szehon Ho <sz...@cloudera.com> wrote:
>
>> In this kind of insert where you mention partition, you need to specify
>> which partition.
>>
>> Example load data local inpath './custs' into table custs
>> partition(cust_prof=1);
>>
>>
>> On Mon, May 19, 2014 at 7:02 PM, Rahul Channe <dr...@googlemail.com>wrote:
>>
>>> I have created the following partitioned table in hive
>>>
>>> create table custs ( cust_id int, first_name String,last_name
>>> String,cust_age int ) partitioned by ( cust_prof String) row format
>>> delimited fields terminated by ',';
>>>
>>> when I am trying to load data into the table, I am getting error
>>>
>>> load data local inpath './custs' into table custs partition(cust_prof);
>>>
>>> FAILED: Error in semantic analysis:
>>> org.apache.hadoop.hive.ql.metadata.HiveException: cust_prof not found in
>>> table's partition spec: {cust_prof=null}
>>>
>>
>>
>
Re: Unable to load data in hive table
Posted by Rahul Channe <dr...@googlemail.com>.
Hi Szehon,
I have following records in my File, I want to load the cust table such a
way that the records are partitioned based on profession
4000001,Kristina,Chung,55,Pilot
4000002,Paige,Chen,74,Teacher
4000003,Sherri,Melton,34,Firefighter
4000004,Gretchen,Hill,66,Computer hardware engineer
4000005,Karen,Puckett,74,Lawyer
4000006,Patrick,Song,42,Veterinarian
4000007,Elsie,Hamilton,43,Pilot
4000008,Hazel,Bender,63,Carpenter
4000009,Malcolm,Wagner,39,Artist
The cust_prof values can be Pilot,Teacher etc.
The command load data local inpath './custs' into table custs
partition(cust_prof=1); doesnt work that way
On Tue, May 20, 2014 at 2:24 PM, Szehon Ho <sz...@cloudera.com> wrote:
> In this kind of insert where you mention partition, you need to specify
> which partition.
>
> Example load data local inpath './custs' into table custs
> partition(cust_prof=1);
>
>
> On Mon, May 19, 2014 at 7:02 PM, Rahul Channe <dr...@googlemail.com>wrote:
>
>> I have created the following partitioned table in hive
>>
>> create table custs ( cust_id int, first_name String,last_name
>> String,cust_age int ) partitioned by ( cust_prof String) row format
>> delimited fields terminated by ',';
>>
>> when I am trying to load data into the table, I am getting error
>>
>> load data local inpath './custs' into table custs partition(cust_prof);
>>
>> FAILED: Error in semantic analysis:
>> org.apache.hadoop.hive.ql.metadata.HiveException: cust_prof not found in
>> table's partition spec: {cust_prof=null}
>>
>
>
Re: Unable to load data in hive table
Posted by Szehon Ho <sz...@cloudera.com>.
In this kind of insert where you mention partition, you need to specify
which partition.
Example load data local inpath './custs' into table custs
partition(cust_prof=1);
On Mon, May 19, 2014 at 7:02 PM, Rahul Channe <dr...@googlemail.com>wrote:
> I have created the following partitioned table in hive
>
> create table custs ( cust_id int, first_name String,last_name
> String,cust_age int ) partitioned by ( cust_prof String) row format
> delimited fields terminated by ',';
>
> when I am trying to load data into the table, I am getting error
>
> load data local inpath './custs' into table custs partition(cust_prof);
>
> FAILED: Error in semantic analysis:
> org.apache.hadoop.hive.ql.metadata.HiveException: cust_prof not found in
> table's partition spec: {cust_prof=null}
>