You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Vishal Kapoor <vi...@gmail.com> on 2011/02/21 19:46:48 UTC
Representing Hierarchy in HBase
Friends,
I was deciding on table designs and came up with a problem where I needed
parent child relationship, a tree kind of dataset.
I did look a few presentations and slides and could not think in the same
way, it was more of HBase vs relational there...
but here is what I did
Grandpa : John
Grandma : Pam
Father : Peter
Mother : Julie
Aunt : Sandra
Sister : Rosy
Cousin : Rob
Table
Family Tree
RowId comment
John/Peter John's family
Pam/Peter Pam's family
John/Peter/Me John's family
Pam/Peter/Me Pam's family
Pam/Sandra/Rob Pam's family
Peter/Me Peter's family start here
Julie/Me Julie's family
Julie/Rosy Julie's family
...
...
the design works for me, and I am able to represent
Countries/States/Zips etc
just wanted to get feedback from friends here...
thanks,
Vishal Kapoor
Re: Representing Hierarchy in HBase
Posted by Dmitriy Lyubimov <dl...@gmail.com>.
I guess you might potentially have saved on key len building a secondary
nested sets index or something along those lines as in
http://en.wikipedia.org/wiki/Nested_set_model
but simplicity of key path approach is hard to beat of course.
On Mon, Feb 21, 2011 at 10:46 AM, Vishal Kapoor
<vi...@gmail.com>wrote:
> Friends,
>
> I was deciding on table designs and came up with a problem where I needed
> parent child relationship, a tree kind of dataset.
> I did look a few presentations and slides and could not think in the same
> way, it was more of HBase vs relational there...
>
> but here is what I did
>
> Grandpa : John
> Grandma : Pam
> Father : Peter
> Mother : Julie
> Aunt : Sandra
> Sister : Rosy
> Cousin : Rob
>
> Table
> Family Tree
> RowId comment
>
> John/Peter John's family
> Pam/Peter Pam's family
> John/Peter/Me John's family
> Pam/Peter/Me Pam's family
> Pam/Sandra/Rob Pam's family
> Peter/Me Peter's family start here
> Julie/Me Julie's family
> Julie/Rosy Julie's family
> ...
> ...
>
>
> the design works for me, and I am able to represent
> Countries/States/Zips etc
>
> just wanted to get feedback from friends here...
>
> thanks,
> Vishal Kapoor
>
Re: Representing Hierarchy in HBase
Posted by Vishal Kapoor <vi...@gmail.com>.
Sure,
the example deals with family tree and we could get
all family starting with a person.
( all John's family under him, similarly all Pam's family under her, also
notice Peter having his own family)
Julie comes from a different family and we don't have her roots here...
a child table can bind parents together,
Child
row Id Parents
Peter father:John
mother=Pam
This shows John and Pam are parents for Peter.
I think a lot of people like me, find it hard to design HBase tables.
and somethings which are hard to express in relational databases are
relatively easy with HBase.
if you have specific questions, please let me know and we could discuss it
here...
Vishal
On Mon, Feb 21, 2011 at 10:40 PM, Jai Krishna <rj...@yahoo-inc.com> wrote:
> Vishal,
>
> Apart from the layout, do you mind listing some of the queries that must be
> satisfied from this datatset?
>
> Thanks
> Jai
>
>
> On 2/22/11 12:16 AM, "Vishal Kapoor" <vi...@gmail.com> wrote:
>
> Friends,
>
> I was deciding on table designs and came up with a problem where I needed
> parent child relationship, a tree kind of dataset.
> I did look a few presentations and slides and could not think in the same
> way, it was more of HBase vs relational there...
>
> but here is what I did
>
> Grandpa : John
> Grandma : Pam
> Father : Peter
> Mother : Julie
> Aunt : Sandra
> Sister : Rosy
> Cousin : Rob
>
> Table
> Family Tree
> RowId comment
>
> John/Peter John's family
> Pam/Peter Pam's family
> John/Peter/Me John's family
> Pam/Peter/Me Pam's family
> Pam/Sandra/Rob Pam's family
> Peter/Me Peter's family start here
> Julie/Me Julie's family
> Julie/Rosy Julie's family
> ...
> ...
>
>
> the design works for me, and I am able to represent
> Countries/States/Zips etc
>
> just wanted to get feedback from friends here...
>
> thanks,
> Vishal Kapoor
>
>
Re: Representing Hierarchy in HBase
Posted by Jai Krishna <rj...@yahoo-inc.com>.
Vishal,
Apart from the layout, do you mind listing some of the queries that must be satisfied from this datatset?
Thanks
Jai
On 2/22/11 12:16 AM, "Vishal Kapoor" <vi...@gmail.com> wrote:
Friends,
I was deciding on table designs and came up with a problem where I needed
parent child relationship, a tree kind of dataset.
I did look a few presentations and slides and could not think in the same
way, it was more of HBase vs relational there...
but here is what I did
Grandpa : John
Grandma : Pam
Father : Peter
Mother : Julie
Aunt : Sandra
Sister : Rosy
Cousin : Rob
Table
Family Tree
RowId comment
John/Peter John's family
Pam/Peter Pam's family
John/Peter/Me John's family
Pam/Peter/Me Pam's family
Pam/Sandra/Rob Pam's family
Peter/Me Peter's family start here
Julie/Me Julie's family
Julie/Rosy Julie's family
...
...
the design works for me, and I am able to represent
Countries/States/Zips etc
just wanted to get feedback from friends here...
thanks,
Vishal Kapoor