hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lars hofhansl <lhofha...@yahoo.com>
Subject Re: HBase- Scan with wildcard character
Date Tue, 13 Dec 2011 06:45:19 GMT
First off, what you want is:   select * from table where id like '4E1167677%'   in MySQL.
Relational databases can typically use indexes to satisfy like "xxx%" type queries, but not
"%xxx%" queries.

HBase is really good at "xxx%" (prefix) type queries.

Just create a scan object, set the startkey to "4E1167677", then call next resulting scanner
until the returned key no longer start with "4E1167677".

In your particular case (since your keys are hex numbers), you can even set the stopKey to
"4E1167677z" (the z will sort after any valid hex digit),
and the scanner will automatically stop at the last possible match.

Have a look at the the Scan object and HTable.getScanner(...)

-- Lars

----- Original Message -----
From: Sreeram K <sreeramk86@yahoo.com>
To: "user@hbase.apache.org" <user@hbase.apache.org>
Sent: Monday, December 12, 2011 6:58 PM
Subject: HBase- Scan with wildcard character


I have a Table defined with the 3 columns.
I am looking for a query in HBase shell to print all the values starting with some characters
in Rowkey.

My rowids are:Coulm+Key
4E11676773AC3B6E9A3FE1CCD1051B8C&1323736118749497       colum=xxxxxx:size,timestamp=67667767,value=

4E11676773AC3B6E9A3FE1CCD1051B8C&132373611874988         colum=11xxxxx:size,timestamp=67667767,value=

4E11676773AC3B6E9A3FE1CCD1051B8C&132373611565656         colum=1xxxxxx:size,timestamp=67667767,value=

Something similar to mysql => select * from table where id='%4E1167677%'

do we have any command like this in the HBase shell - Scan with wild characters?

(or) should we end up using HIVE ? what are the other options?

Can you please let me know.


View raw message