- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
HBASE INSERT json
- Labels:
-
Apache HBase
Created 05-03-2016 10:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
I need to insert every day 1 json into HBASE, there are any api to do it without schema???
Also i dont want to use HIVE.
Thanks
Created 05-03-2016 11:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you can treat each json as string then in HBase you would do the following where line is a json string. Full example here https://github.com/dbist/workshops/blob/master/hbase/HBaseJsonLoad/src/main/java/com/hortonworks/hba...
p.addColumn(CF, Bytes.toBytes("json"), Bytes.toBytes(line));
Created 05-03-2016 11:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you can treat each json as string then in HBase you would do the following where line is a json string. Full example here https://github.com/dbist/workshops/blob/master/hbase/HBaseJsonLoad/src/main/java/com/hortonworks/hba...
p.addColumn(CF, Bytes.toBytes("json"), Bytes.toBytes(line));
Created 05-03-2016 12:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi;
thanks, and them how can i get some keys from the json???
Created 05-03-2016 12:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You read the string, convert it up json obj and read it. Look at my example how I read the key to make it a row key, you will do the same after calling a Get.
Created 05-03-2016 04:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, thanks i saw the code, you are right,
and what about autoincrement id row from pig'
Created 05-03-2016 11:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see you asked this question in a separate thread, that's the right approach to keep them separate.
