Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # user - Regarding Rowkey and Column Family


Copy link to this message
-
Re: Regarding Rowkey and Column Family
Jean-Marc Spaggiari 2012-12-26, 16:24
Hi Rams,

I don't have the JSon created on the same place where I'm storing it
in HBase so the code I can provide will not really be helpful.

JSon is giving you a string.

So a put will "simply" look like that:
Put entry= new Put (key); // Key is an array of byte.
entry.add(CF_DUMMY, C_DUMMY, Bytes.toBytes(youJSonString));
put_entry.add(email); // put_entry is an array of put that I give to
my HTable later.

JM

2012/12/26, Ramasubramanian Narayanan <[EMAIL PROTECTED]>:
> Hi,
>
> Will be helpful if you could send a sample program/script..
>
> regards,'
> Rams
>
> On Wed, Dec 26, 2012 at 9:09 PM, Mohammad Tariq <[EMAIL PROTECTED]> wrote:
>
>> I would rather serialize the JSON object into a byte array and then store
>> it into an HBase cell. Later whenever I need to pull out some value, I
>> can
>> deserialize it and get the result.
>>
>> If you know the column name in advance, you can use the QualifierFilter
>> to
>> get the rows.
>>
>> Best Regards,
>> Tariq
>> +91-9741563634
>> https://mtariq.jux.com/
>>
>>
>> On Wed, Dec 26, 2012 at 8:35 PM, Ramasubramanian Narayanan <
>> [EMAIL PROTECTED]> wrote:
>>
>> > Hi,
>> >
>> > Thanks a lot... Can you please help me a sample code how to insert &
>> > read
>> > Json object in HBase...
>> >
>> > Also how  to select the particular row from column (inserted thru Json
>> > sobject).
>> >
>> > Have given the script based on  google'ng we did... Please help in
>> > using
>> > this script how to use in HBase shell script also in Java..
>> >
>> >
>> > -----------------------------
>> > { "Customer": {
>> > "Customer Detail": [
>> > {"CustomerNumber": "10000000001",
>> >         "DOB": "01/01/01",
>> >         "Fname": "Fname1",
>> >         "Mname": "Mname1",
>> >         "Lname": "Lname1",
>> > "address": {
>> >         "AddressType": "Home",
>> >       "AddressLine1" :"1.1.Address Line1",
>> >     "AddressLine2" :"1.1.Address Line2",
>> >       "AddressLine3" :"1.1.Address Line3",
>> >       "AddressLine4" :"1.1.Address Line4",
>> >      "State" :"1.1.State",
>> >     "City" :"1.1.City",
>> >       "Country" :"1.1.Country"
>> >       }
>> > },
>> >     { "CustomerNumber": "10000000002",
>> >         "DOB": "01/02/01",
>> >         "Fname": "Fname2",
>> >         "Mname": "Mname2",
>> >         "Lname": "Lname2",
>> > "address": [{
>> >         "AddressType": "Home",
>> >       "AddressLine1" :"2.1.Address Line1",
>> >     "AddressLine2" :"2.1.Address Line2",
>> >       "AddressLine3" :"2.1.Address Line3",
>> >       "AddressLine4" :"2.1.Address Line4",
>> >      "State" :"2.1.State",
>> >     "City" :"2.1.City",
>> >       "Country" :"2.1.Country"
>> >       },
>> >   {
>> >         "AddressType": "Office",
>> >       "AddressLine1" :"2.2.Address Line1",
>> >     "AddressLine2" :"2.2.Address Line2",
>> >       "AddressLine3" :"2.2.Address Line3",
>> >       "AddressLine4" :"2.2.Address Line4",
>> >      "State" :"2.2.State",
>> >     "City" :"2.2.City",
>> >       "Country" :"2.2.Country"
>> >       }
>> > ]
>> >
>> >       },
>> >       { "CustomerNumber": "10000000003",
>> >         "DOB": "01/03/01",
>> >         "Fname": "Fname3",
>> >         "Mname": "Mname3",
>> >         "Lname": "Lname3",
>> > "address": [{
>> >         "AddressType": "Home",
>> >       "AddressLine1" :"3.1.Address Line1",
>> >     "AddressLine2" :"3.1.Address Line2",
>> >       "AddressLine3" :"3.1.Address Line3",
>> >       "AddressLine4" :"3.1.Address Line4",
>> >      "State" :"3.1.State",
>> >     "City" :"3.1.City",
>> >       "Country" :"3.1.Country"
>> >       },
>> >   {
>> >         "AddressType": "Office",
>> >       "AddressLine1" :"3.2.Address Line1",
>> >     "AddressLine2" :"3.2.Address Line2",
>> >       "AddressLine3" :"3.2.Address Line3",
>> >       "AddressLine4" :"3.2.Address Line4",
>> >      "State" :"3.2.State",
>> >     "City" :"3.2.City",
>> >       "Country" :"3.2.Country"
>> >       },
>> >   {
>> >         "AddressType": "Others",
>> >       "AddressLine1" :"3.3.Address Line1",