hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Udit Mehta <ume...@groupon.com>
Subject Re: Hive JSON Create Table query error: ParseException line 3:14 cannot recognize input near ':' 'string' ',' in column type
Date Fri, 08 May 2015 19:32:47 GMT
Hey,

You dont need the ":" for the fields 'tweetmessage" and "createddate".
Thats what causing the issue.
This should work:
CREATE EXTERNAL TABLE twitter_data(
  userdata struct
<userlocation:string,id:bigint,name:string,screenname:string>,
  tweetmessage string, createddate string)
  ROW FORMAT SERDE 'org.apache.hcatalog.JsonSerDe';

Best,
Udit


On Thu, May 7, 2015 at 6:01 PM, mani kandan <mankand007@gmail.com> wrote:

> I'm trying to import a JSON file into a hive table, and trying to execute
> the below query:
>
> CREATE EXTERNAL TABLE twitter_data(
>   userdata struct
> <userlocation:string,id:bigint,name:string,screenname:string>,
>   tweetmessage:string, createddate:string)
>   ROW FORMAT SERDE 'org.apache.hcatalog.JsonSerDe';
>
> Upon execution I'm getting the following error:
>
> *Error occurred executing hive query: Error while compiling statement:
> FAILED: ParseException line 3:14 cannot recognize input near ':' 'string'
> ',' in column type*
>  More Info   View Logs <http://centos1.example.com:8000/logs>
>
> My input data looks like this:
> {"user":{"userlocation":"Cinderford,
> Gloucestershire","id":230231618,"name":"Aimee","screenname":"Aimee_Cottle","geoenabled":true},"tweetmessage":"Gastroenteritis
> has pretty much killed me this week :( off work for a few days whilst I
> recover!","createddate":"2013-06-20T12:08:14","geolocation":null}
>
>
> ​Please let me know what I'm doing wrong here and what is the best way to
> load this data into hive.​
>
> --
> Thanks,
> *Manikandan Ramakrishnan*
>

Mime
View raw message