You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by bharath vissapragada <bh...@gmail.com> on 2009/08/01 06:11:51 UTC

Re: HBase schema design

See the example on the bottom of the page ..

http://hadoop.apache.org/hbase/docs/r0.19.3/api/overview-summary.html

It is very well documented ... and u can easily understand!

On Fri, Jul 31, 2009 at 2:26 PM, Ninad Raut <hb...@gmail.com>wrote:

> Use a Scanner instead of a get....
>
> 2009/7/31 <y_...@tsmc.com>
>
> > As to your suggestion, how do I complete following codes?
> > or any better codes would be great!
> >
> > HTable table = new HTable(config, "user");
> > Get g = new Get(Bytes.toBytes("U1"));
> > Result r = table.get(g);
> >
> > for loop---     //I don't know how many articles the user have.
> >   byte [] t = r.getValue(Bytes.toBytes("chapter"), Bytes.toBytes("?"));
> > //t1
> >   byte [] c = r.getValue(Bytes.toBytes("chapter"), Bytes.toBytes("?"));
> > //c1
> >   byte [] d = r.getValue(Bytes.toBytes("chapter"), Bytes.toBytes("?"));
> > //d1
> > end loop---
> >
> > Thank you very much
> >
> > Fleming
> > 宏明
> >
> >
> >
> >
> >                      Ninad Raut
> >                      <hbase.user.ninad        To:
> > hbase-user@hadoop.apache.org
> >                      @gmail.com>              cc:      (bcc:
> > Y_823910/TSMC)
> >                                               Subject: Re: HBase schema
> > design
> >                      2009/07/31 11:48
> >                      AM
> >                      Please respond to
> >                      hbase-user
> >
> >
> >
> >
> >
> >
> > create user as your row key. then create a columnFamily called chapter.
> For
> > each column entry store a json string which will contain  title,content
> and
> > creation date. Using google's gson marsheller to convert your POJO object
> > to
> > JSON string.
> >  U1  chapter:{t1,c1,d1},chapter:{t2,c2,d2}... etc...
> > let me know if it helps.
> >
> > 2009/7/31 <y_...@tsmc.com>
> >
> > > Hi there,
> > >
> > > If I want to save my user's articles, I want to know how to create
> HBase
> > > schema.
> > >
> > > key value   title      content     create_date
> > > U1           t1          c1             d1
> > > U1           t2          c2             d2
> > > U1           t3          c3             d3
> > >
> > > After the user sign in,I want to show the user's(U1) article
> > > title(t1,t2,t3)
> > > Sorry, I am not familiar with Column-Oriented design. I really want to
> > know
> > > the
> > > correct way to design HBase schema.
> > > Any suggestion would be appreciated!
> > >
> > > Fleming
> > > 宏明
> > >
> > >
> >
> ---------------------------------------------------------------------------
> > >                                                         TSMC PROPERTY
> > >  This email communication (and any attachments) is proprietary
> > information
> > >  for the sole use of its
> > >  intended recipient. Any unauthorized review, use or distribution by
> > anyone
> > >  other than the intended
> > >  recipient is strictly prohibited.  If you are not the intended
> > recipient,
> > >  please notify the sender by
> > >  replying to this email, and then delete this email and any copies of
> it
> > >  immediately. Thank you.
> > >
> > >
> >
> ---------------------------------------------------------------------------
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
>  ---------------------------------------------------------------------------
> >                                                          TSMC PROPERTY
> >  This email communication (and any attachments) is proprietary
> information
> >  for the sole use of its
> >  intended recipient. Any unauthorized review, use or distribution by
> anyone
> >  other than the intended
> >  recipient is strictly prohibited.  If you are not the intended
> recipient,
> >  please notify the sender by
> >  replying to this email, and then delete this email and any copies of it
> >  immediately. Thank you.
> >
> >
>  ---------------------------------------------------------------------------
> >
> >
> >
> >
>

Re: HBase schema design

Posted by Erik Holstad <er...@gmail.com>.
Hey!
Two things, if you are only looking for data from one family, you should try
to put that into the request, might not make a difference in your case, if
you only have one family.
The other thing is how you are looking at the result. In most cases, in my
opinion, the best way to look at the result is to manually go through the
List<KeyValues> in the result and not make it into a map and then ask for
the specific family+qualifier, but that is something you can test and see
which one is faster.

Erik