You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Jason Huang <ja...@icare.com> on 2012/09/19 18:53:55 UTC
Nested Entity Implementation?
Hello,
I am designing a HBase table for user activity and I want to use a
nested entity to store the login information as following:
(1) Define a column qualifier named "user login" use this as a nested entity;
(2) This nested entity will have the following attributes:
total # of login
time of log in #1
time of log in #2
....
time of last log in
(3) Each attributes in the step above (except for the total # of
login) will be another nested entity, which will include the following
attributes:
time of log out
user log in IP
browser used
......
My question is - is there any handy API that will allow us to write
these type of nested entity to the column in the table? I looked at
the HTable.put method but that appears to only accept a byte code as
input value. We could implement the nested entity to a class with
attributes and nested objects but I am not sure how to write these
data to the table. I tried to search online but couldn't find any
good post talking about how to implement a nested entity (there are
some posts out there talking about using this type of design, though).
Thanks!
Jason
Re: Nested Entity Implementation?
Posted by Jason Huang <ja...@icare.com>.
I see. Thanks for bringing the utility class to my attention.
Jason
On Thu, Sep 20, 2012 at 2:32 AM, anil gupta <an...@gmail.com> wrote:
> Hi Jason,
>
> AFAIK, you need to write custom serialization and deserialization code for
> this kind of stuff. For any primitive data type and some others like
> BigDecimal, HBase has a utility class named as
> org.apache.hadoop.hbase.util.Bytes. You might take advantage of this class
> in your code if you can.
>
> HTH,
> Anil
>
> On Wed, Sep 19, 2012 at 10:11 AM, Jason Huang <ja...@icare.com> wrote:
>
>> I think I should clarify my question - is there any existing tool to
>> help convert these type of nested entities to byte arrays so I can
>> easily write them to the column, or do I need to write my own
>> serialization/deserialization?
>>
>> thanks!
>>
>> Jason
>>
>> On Wed, Sep 19, 2012 at 12:53 PM, Jason Huang <ja...@icare.com>
>> wrote:
>> > Hello,
>> >
>> > I am designing a HBase table for user activity and I want to use a
>> > nested entity to store the login information as following:
>> >
>> > (1) Define a column qualifier named "user login" use this as a nested
>> entity;
>> >
>> > (2) This nested entity will have the following attributes:
>> > total # of login
>> > time of log in #1
>> > time of log in #2
>> > ....
>> > time of last log in
>> >
>> > (3) Each attributes in the step above (except for the total # of
>> > login) will be another nested entity, which will include the following
>> > attributes:
>> > time of log out
>> > user log in IP
>> > browser used
>> > ......
>> >
>> > My question is - is there any handy API that will allow us to write
>> > these type of nested entity to the column in the table? I looked at
>> > the HTable.put method but that appears to only accept a byte code as
>> > input value. We could implement the nested entity to a class with
>> > attributes and nested objects but I am not sure how to write these
>> > data to the table. I tried to search online but couldn't find any
>> > good post talking about how to implement a nested entity (there are
>> > some posts out there talking about using this type of design, though).
>> >
>> > Thanks!
>> >
>> > Jason
>>
>
>
>
> --
> Thanks & Regards,
> Anil Gupta
Re: Nested Entity Implementation?
Posted by anil gupta <an...@gmail.com>.
Hi Jason,
AFAIK, you need to write custom serialization and deserialization code for
this kind of stuff. For any primitive data type and some others like
BigDecimal, HBase has a utility class named as
org.apache.hadoop.hbase.util.Bytes. You might take advantage of this class
in your code if you can.
HTH,
Anil
On Wed, Sep 19, 2012 at 10:11 AM, Jason Huang <ja...@icare.com> wrote:
> I think I should clarify my question - is there any existing tool to
> help convert these type of nested entities to byte arrays so I can
> easily write them to the column, or do I need to write my own
> serialization/deserialization?
>
> thanks!
>
> Jason
>
> On Wed, Sep 19, 2012 at 12:53 PM, Jason Huang <ja...@icare.com>
> wrote:
> > Hello,
> >
> > I am designing a HBase table for user activity and I want to use a
> > nested entity to store the login information as following:
> >
> > (1) Define a column qualifier named "user login" use this as a nested
> entity;
> >
> > (2) This nested entity will have the following attributes:
> > total # of login
> > time of log in #1
> > time of log in #2
> > ....
> > time of last log in
> >
> > (3) Each attributes in the step above (except for the total # of
> > login) will be another nested entity, which will include the following
> > attributes:
> > time of log out
> > user log in IP
> > browser used
> > ......
> >
> > My question is - is there any handy API that will allow us to write
> > these type of nested entity to the column in the table? I looked at
> > the HTable.put method but that appears to only accept a byte code as
> > input value. We could implement the nested entity to a class with
> > attributes and nested objects but I am not sure how to write these
> > data to the table. I tried to search online but couldn't find any
> > good post talking about how to implement a nested entity (there are
> > some posts out there talking about using this type of design, though).
> >
> > Thanks!
> >
> > Jason
>
--
Thanks & Regards,
Anil Gupta
Re: Nested Entity Implementation?
Posted by Jason Huang <ja...@icare.com>.
I think I should clarify my question - is there any existing tool to
help convert these type of nested entities to byte arrays so I can
easily write them to the column, or do I need to write my own
serialization/deserialization?
thanks!
Jason
On Wed, Sep 19, 2012 at 12:53 PM, Jason Huang <ja...@icare.com> wrote:
> Hello,
>
> I am designing a HBase table for user activity and I want to use a
> nested entity to store the login information as following:
>
> (1) Define a column qualifier named "user login" use this as a nested entity;
>
> (2) This nested entity will have the following attributes:
> total # of login
> time of log in #1
> time of log in #2
> ....
> time of last log in
>
> (3) Each attributes in the step above (except for the total # of
> login) will be another nested entity, which will include the following
> attributes:
> time of log out
> user log in IP
> browser used
> ......
>
> My question is - is there any handy API that will allow us to write
> these type of nested entity to the column in the table? I looked at
> the HTable.put method but that appears to only accept a byte code as
> input value. We could implement the nested entity to a class with
> attributes and nested objects but I am not sure how to write these
> data to the table. I tried to search online but couldn't find any
> good post talking about how to implement a nested entity (there are
> some posts out there talking about using this type of design, though).
>
> Thanks!
>
> Jason