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 <[email protected]> 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* >
