You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Mukesh Jha <me...@gmail.com> on 2016/02/11 13:41:00 UTC

hbase filter based on dynamic column qualifier's value

Hi

I'm storing an array of attributes having attributes+index as qualifier
name, my column family name is 'cf' here.

Each row in my HBase table that looks like below.

cf:attribute1 -> 'value apple'
cf:attribute2 -> 'value banana'
cf:attribute{N} -> 'value iphone'
cf:someId1 -> 1111
cf:someOtherQualifier -> 'value e'


While reading data our of HBase I want to scan my table and use an *ValueFilter
*on the cf:attribute* columns for a value (say "apple").

On a match I want the entirerows to be returned.

Below are possible solutions for me

   - Add multiple SingleColumnValue filters for each attribute*. But I
   donot know the no. of items that will be present in attribute* also the
   list might go till 100 so will it affect the scan performance?
   - Store the attributes arraylist as ArrayWritable [1], I'm now sure how
   the scan filter's will work here. If any of you have any experience please
   help.
   - Implement my own filter and ship it in all my RS.

*[1]:*
http://grepcode.com/file/repo1.maven.org/maven2/com.ning/metrics.action/0.2.0/org/apache/hadoop/io/ArrayWritable.java

-- 
Thanks & Regards,

*Mukesh Jha <me...@gmail.com>*

Re: hbase filter based on dynamic column qualifier's value

Posted by Ted Yu <yu...@gmail.com>.
Please take a look at filterKeyValue(Cell) method of
SingleColumnValueFilter :

    if (!CellUtil.matchingColumn(c, this.columnFamily, this.columnQualifier))
{

When you write your own Filter supporting multiple columns, rewrite the
above check to fit your needs.

Cheers

On Thu, Feb 11, 2016 at 4:41 AM, Mukesh Jha <me...@gmail.com> wrote:

> Hi
>
> I'm storing an array of attributes having attributes+index as qualifier
> name, my column family name is 'cf' here.
>
> Each row in my HBase table that looks like below.
>
> cf:attribute1 -> 'value apple'
> cf:attribute2 -> 'value banana'
> cf:attribute{N} -> 'value iphone'
> cf:someId1 -> 1111
> cf:someOtherQualifier -> 'value e'
>
>
> While reading data our of HBase I want to scan my table and use an
> *ValueFilter
> *on the cf:attribute* columns for a value (say "apple").
>
> On a match I want the entirerows to be returned.
>
> Below are possible solutions for me
>
>    - Add multiple SingleColumnValue filters for each attribute*. But I
>    donot know the no. of items that will be present in attribute* also the
>    list might go till 100 so will it affect the scan performance?
>    - Store the attributes arraylist as ArrayWritable [1], I'm now sure how
>    the scan filter's will work here. If any of you have any experience
> please
>    help.
>    - Implement my own filter and ship it in all my RS.
>
> *[1]:*
>
> http://grepcode.com/file/repo1.maven.org/maven2/com.ning/metrics.action/0.2.0/org/apache/hadoop/io/ArrayWritable.java
>
> --
> Thanks & Regards,
>
> *Mukesh Jha <me...@gmail.com>*
>