Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 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
Hello Ram,

    You can use PrefixFilter to do that.
Filter filter = new PrefixFilter(Bytes.toBytes("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..
>>We don't have any 'where' clause in HBase. Also, you could end up with RS
Hotspotting with this kind of key design.

Best Regards,
Tariq
+91-9741563634
https://mtariq.jux.com/
On Thu, Dec 27, 2012 at 3:37 PM, Asaf Mesika <[EMAIL PROTECTED]> wrote:

> 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
>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB