You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Bill Graham <bi...@gmail.com> on 2011/02/18 19:57:15 UTC

FilterList not working as expected

Hi,

I'm unable to get ColumnPrefixFilter working when I use it in a
FilterList and I'm wondering if this is a bug or a mis-usage on my
part. If I set ColumnPrefixFilter directly on the Scan object all
works fine. The following code shows an example of scanning a table
with a column descriptor 'info:last_name' where we only want rows
where that column exists. Approach #1 below doesn't filter, but #2
does. I'm using the latest 0.90.1 snapshot (0.90.1-20110215.213202-4).

HTable table = new HTable("SampleTable");
Scan s = new Scan();

byte[] colPrefix = Bytes.toBytes("last_");
Filter prefixFilter = new ColumnPrefixFilter(colPrefix);

// Approach 1: the following 3 lines do not filter
FilterList filterList = new FilterList();
filterList.addFilter(prefixFilter);
s.setFilter(filterList);

// Approach #2: if I instead use this, filtering is fine
//s.setFilter(prefixFilter);

ResultScanner scanner = table.getScanner(s);


thanks,
Bill

Re: FilterList not working as expected

Posted by Bill Graham <bi...@gmail.com>.
Just to follow up, this appears to be a bug. I've created a JIRA.

https://issues.apache.org/jira/browse/HBASE-3550

On Fri, Feb 18, 2011 at 10:57 AM, Bill Graham <bi...@gmail.com> wrote:
> Hi,
>
> I'm unable to get ColumnPrefixFilter working when I use it in a
> FilterList and I'm wondering if this is a bug or a mis-usage on my
> part. If I set ColumnPrefixFilter directly on the Scan object all
> works fine. The following code shows an example of scanning a table
> with a column descriptor 'info:last_name' where we only want rows
> where that column exists. Approach #1 below doesn't filter, but #2
> does. I'm using the latest 0.90.1 snapshot (0.90.1-20110215.213202-4).
>
> HTable table = new HTable("SampleTable");
> Scan s = new Scan();
>
> byte[] colPrefix = Bytes.toBytes("last_");
> Filter prefixFilter = new ColumnPrefixFilter(colPrefix);
>
> // Approach 1: the following 3 lines do not filter
> FilterList filterList = new FilterList();
> filterList.addFilter(prefixFilter);
> s.setFilter(filterList);
>
> // Approach #2: if I instead use this, filtering is fine
> //s.setFilter(prefixFilter);
>
> ResultScanner scanner = table.getScanner(s);
>
>
> thanks,
> Bill
>