hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ike Walker <ike.wal...@flite.com>
Subject Combining 2 JSON objects in Hive
Date Tue, 28 May 2013 14:56:12 GMT
Hello,

I have two JSON objects stored as strings in a Hive table.

I would like to combine them into a single JSON object in Hive.

I'm running Hive 0.7, but am planning to upgrade soon so a solution that works in Hive 0.8
could be acceptable as well.

For example, here's the data now:
+-------------------------------------+-------------------------------+
| col1                                | col2                          |
+-------------------------------------+-------------------------------+
| {"age":"Over 30","gender":"female"} | {"counter":"0","version":"1"  |
| {"age":"Over 30","gender":"female"} | {"counter":"4","version":"1"  |
| {"age":"Over 30","gender":"male"}   | {"counter":"10","version":"1" |
+-------------------------------------+-------------------------------+

And here's what I want to select:

{"age":"Over 30","gender":"female","counter":"0","version":"1"}
{"age":"Over 30","gender":"female","counter":"4","version":"1"}
{"age":"Over 30","gender":"male","counter":"10","version":"1"}

Thanks,
Ike Walker
Mime
View raw message