We are trying to use the mongodb data in hive, document has array of subdocuments.. How can I load the complex data into hive?
Here is the sample json:
{
"_id" : ObjectId("582c8cb9913e2f21e062aaa6"),
"acct" : NumberLong(12345),
"history" : [
{
"startDate" : ISODate("2016-09-01T16:00:00.000Z"),
"endDate" : ISODate("2016-09-30T16:00:00.000Z"),
"averageDailyBal" : "2653.85"
},
{
"startDate" : ISODate("2016-10-01T16:00:00.000Z"),
"endDate" : ISODate("2016-10-31T16:00:00.000Z"),
"averageDailyBal" : "1840.15"
},
{
"startDate" : ISODate("2016-11-01T16:00:00.000Z"),
"endDate" : ISODate("2016-11-30T17:00:00.000Z"),
"averageDailyBal" : "2796.14"
}
]
}
Thanks...
As you know The data in MongoDB is stored in JSON format, So you can use any Json serde to parse the data in it.
Refer this