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

Switch to Threaded View
HBase >> mail # user >> How to use substring in Rowkey


Copy link to this message
-
Re: How to use substring in Rowkey
You can define the StartKey of your scan object to be the customer
number (i.e. the prefix of your rowkey)
Define the end key to be the same but append a zero byte at the end to
signify include of the rowkey.
This should retrieve all rows starting with that customer number.
Sent from my iPhone

On 27 בדצמ 2012, at 11:54, Ramasubramanian Narayanan
<[EMAIL PROTECTED]> wrote:

> Hi,
>
> Suppose a rowkey contains some 5 fields delimited by "|", then how to use
> the same in the where clause?
>
> For example, I have some 4 customer records who is having different number
> address .. for simplicity, I had for customer number 1,he has only one
> address, for customer number 2, he has two addresses, like wise till 4
> customer..
>
> So totally there will be 10 records in my table...
>
> Customer Number   Number of address
> Customer 1                          - 1
> Customer 2                          - 2
> Customer 3                          - 3
> Customer 4                          - 4
>                                               -----
>                                                 10
>
> *Here is my rowkey: (Customer number | Type of address)*
> 10000000001|OFFICE
> 10000000002|HOME
> 10000000002|OFFICE
> 10000000003|HOME
> 10000000003|OFFICE
> 10000000003|OTHERS
> 10000000004|HOME
> 10000000004|OFFICE1
> 10000000004|OFFICE2
> 10000000004|OTHERS
>
>
> Now question is, how to select all the details of customer 4 (customer
> number 10000000004)?
> Is it possible to use substring of rowkey in the where clause? I don't know
> whether he may have home/office or any type of address..
>
> Please help in providing query for the same..
>
> regards,
> Rams