hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sreeram K <sreeram...@yahoo.com>
Subject Re: HBase- Scan with wildcard character
Date Thu, 15 Dec 2011 16:59:00 GMT
I have one more question..
Can we have a query in HBase shell based on Colum Value.

I am looking at scan-> with Coulm ID? is that possible..the way we are doing with STARTROW?
Can you pl pont me to an example..



----- Original Message -----
From: Sreeram K <sreeramk86@yahoo.com>
To: "user@hbase.apache.org" <user@hbase.apache.org>; lars hofhansl <lhofhansl@yahoo.com>
Cc: 
Sent: Wednesday, December 14, 2011 6:46 AM
Subject: Re: HBase- Scan with wildcard character

Thank you Lars.
STOPROW did work in my hbase shell as you suggested



----- Original Message -----
From: lars hofhansl <lhofhansl@yahoo.com>
To: "user@hbase.apache.org" <user@hbase.apache.org>; Sreeram K <sreeramk86@yahoo.com>
Cc: 
Sent: Tuesday, December 13, 2011 3:56 PM
Subject: Re: HBase- Scan with wildcard character

The shell lets you only do that much.
HBase does not support % wildcard. It just happens to work in your case because % has a low
ascii code.


You set the startRow of the scan. It does not need to exist, but the value must sort before
the rows your are looking for and after all rows before it.
Same for the stopRow. It does not need to exist, but it must sort after the rows your are
looking and before all rows you do not want to see.

Try setting STARTROW to "sample1" and STOPROW to "sample1\255". That will work as long as
ascii 255 is not used in your row keys.

-- Lars



________________________________
From: Sreeram K <sreeramk86@yahoo.com>
To: "user@hbase.apache.org" <user@hbase.apache.org>; lars hofhansl <lhofhansl@yahoo.com>

Sent: Tuesday, December 13, 2011 2:16 PM
Subject: Re: HBase- Scan with wildcard character

Thanks Doug. I am looking more from HBase shell for this.


----- Original Message -----
From: Doug Meil <doug.meil@explorysmedical.com>
To: "user@hbase.apache.org" <user@hbase.apache.org>; Sreeram K <sreeramk86@yahoo.com>;
lars hofhansl <lhofhansl@yahoo.com>
Cc: 
Sent: Tuesday, December 13, 2011 2:01 PM
Subject: Re: HBase- Scan with wildcard character


Hi there-

At some point you're probably going to want to get out of the shell, take
a look at this...

http://hbase.apache.org/book.html#scan






On 12/13/11 4:43 PM, "Sreeram K" <sreeramk86@yahoo.com> wrote:

>Thanks Lars. I am looking into that.
>
>Is there a way we can search all the entries starting  with 565HGOUO and
>print all the rows?
>
>Example:
>scan 'SAMPLE_TABLE' ,{COLUMNS
>=>['sample_info:FILENAME','event_info:FILENAME'],STARTROW=>'sample1%'}
>
>I am seeing all the Rows and information after that sample1% row in the
>DB.
>if for instance I have extra1rowid after sample1%, I am able to see that
>also.
>
>I am looking for a query to print only the rows which has Rowid starting
>with sample1%.
>
>can you let me know if we can get a query like that on hbase shell
>
>
>
>----- Original Message -----
>From: lars hofhansl <lhofhansl@yahoo.com>
>To: "user@hbase.apache.org" <user@hbase.apache.org>; Sreeram K
><sreeramk86@yahoo.com>
>Cc: 
>Sent: Tuesday, December 13, 2011 11:36 AM
>Subject: Re: HBase- Scan with wildcard character
>
>info:regioninfo is actually a serialized Java object (HRegionInfo). What
>you see in the shell the result of HRegionInfo.toString(), which looks
>like a 
>
>ruby object, but it is really just a string (see HRegionInfo.toString()).
>
>
>
>________________________________
>From: Sreeram K <sreeramk86@yahoo.com>
>To: "user@hbase.apache.org" <user@hbase.apache.org>; lars hofhansl
><lhofhansl@yahoo.com>
>Sent: Tuesday, December 13, 2011 12:16 AM
>Subject: Re: HBase- Scan with wildcard character
>
>Thanks Lars, I will look into that .
>
>one more question: on hbase shell.
>
>If I have :
>           hbase> scan 't1.', {COLUMNS => 'info:regioninfo'}  , it is
>printing all the colums of regioninfo.
>
>
>can I have a condition like:if colum,info.regioninfo=2 (value) than print
>all the associated columns like info:regioninfo1, regioninfo2.
>
>
>
>----- Original Message -----
>From: lars hofhansl <lhofhansl@yahoo.com>
>To: "user@hbase.apache.org" <user@hbase.apache.org>; Sreeram K
><sreeramk86@yahoo.com>
>Cc: 
>Sent: Monday, December 12, 2011 10:45 PM
>Subject: Re: HBase- Scan with wildcard character
>
>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>
>Cc: 
>Sent: Monday, December 12, 2011 6:58 PM
>Subject: HBase- Scan with wildcard character
>
>Hi,
>
>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.
>
>Example:
>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.
>
>-Sreeram 
>


Mime
View raw message