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

Switch to Plain View
HBase >> mail # user >> some problem about HBase index


+
fx_bull 2013-06-13, 08:16
+
rajeshbabu chintaguntla 2013-06-13, 10:22
+
Michel Segel 2013-06-13, 10:33
+
fx_bull 2013-06-14, 02:21
Copy link to this message
-
Re: some problem about HBase index
Please help us understand. My read of your question is that you want to
query for students in two ways:
 - "get the student with name 'jean'"
 - "get the student with id 12"

With the rowkey as student name, only the first query is possible with a
simple GET. Likewise, with the rowkey as student id, only the second query
is possible with a simple GET.

As Rajeshbabu pointed out, you would need to use a SCAN with a filter to
query by the attribute for which your schema is not defined. Your
alternative is to maintain a second table whose rowkey provides for the
second query. That second table can contain an entire copy of the student
record (this is denomralization at its worst) or it can contain only a
single cell pointing to the rowkey value of the source table. In HBase, we
call this a "secondary index".

Using a compound rowkey, you could ask a more complex question with a
single GET, for instance "get the student with name 'jean' and whose age is
189". This kind of question is implemented as a compound rowkey and your
schema would look something like this:

rowkey    cf:info
name/age  {name, id, height, weight, age, ...}

You can use this same schema to answer "get me all students whose name is
'jean'" by using a SCAN with a PrefixFilter.

Thanks,
Nick

On Thu, Jun 13, 2013 at 7:21 PM, fx_bull <[EMAIL PROTECTED]> wrote:

>
> Thanks
>
> What's I mean is that both of the name of a student  and student_id  as a
> rowkey
>
> As below
>
> table's structure
>
>                                          family: col
> rowkey     rowkey         student:info
>
> jean            12
> {'age':'189','name':'jean','id':'12','height':'76'…...}
>
> ….              …..               ……..
>
>
>
> pic
>
>
>
>
>
>
>
> 在 2013-6-13,下午6:33,Michel Segel <[EMAIL PROTECTED]> 写道:
>
> comprised
>
>
>
+
fx_bull 2013-06-14, 02:25