JSON documents using Hive
JSON, is a minimal readable format for structuring data. It is used primarily to transmit data between a server and web application as an alternative to XML. JSON is built on two structures:
- A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
- An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.
Please read more on JSON at the following URL: http://www.json.org/.http://www.json.org/
Example 1 – Accessing simple JSON documents with Hive (Hive 0.14 and later versions)
In this example, we will see how to query simple JSON documents using HiveQL. Let's assume we want to access the following Sample-Json-simple.json
file in HiveSample-Json-simple.json
:
{"username":"abc","tweet":"Sun shine is bright.","time1": "1366150681" } {"username":"xyz","tweet":"Moon light is mild .","time1": "1366154481" }
View the Sample-Json-simple...