sql - hive query schema creation for nested fields -
i trying add hive schema , partition query data hdfs file system has nested fields(parent, sub , sub of sub field).
my data format is:
country -> main field state -> sub field of main field "country" city -> sub field of field "state"
hive schema:
create external table if not exists test_table ( country map<string,map<string,string>> ) partitioned (date string, hour string) row format serde 'org.openx.data.jsonserde.jsonserde' stored textfile location '/user/logs/';
i query country['state']
, country['city']
above table not able query parent field "country"
. if change schema country map<string,string>
, works country
, country['state']
works not country['start']['city']
it throws error message:
failed exception java.io.ioexception:org.apache.hadoop.hive.ql.metadata.hiveexception: java.lang.classcastexception: java.lang.string cannot cast org.openx.data.jsonserde.json.jsonobject
how can query 3 fields (parent, child , child of child)?
Comments
Post a Comment