HIVE Create table for JSON - STRUCT Error HIVE Create table for JSON - STRUCT Error hadoop hadoop

HIVE Create table for JSON - STRUCT Error


WINDOW is a reserved key word in Hive and directly you cannot use reserved as part of your column,reserved key words

You have two options here:

1.) Do not use any reserved key work as part of columns. Try renaming your object name from window to say window1 and it will work.

2.) If you want to use keywords then use like this `window`, back quote and the column(key word)So your create table will look like :

CREATE TABLE complex_json(widget struct< `window` :struct< title:string,name:string,width:int,height:int>,debug:string,image:struct< src:string,name:string,hOffset:int,vOffset:int,alignment:string > >)ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe';

Also make sure your JSON is in single line. All these SerDes don't recognize proper formatted JSON.

Hope it helps...!!!