You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Arvid Warnecke <ar...@nostalgix.org> on 2013/11/07 08:27:25 UTC

Combining filters in the HBase shell

Hello,

I have some issues when I try to use filters in the shell.
When I use only one filter everything is okay:

scan 'rawdb', { COLUMNS => 'raw:a', FILTER => \
SingleColumnValueFilter.new(Bytes.toBytes('raw'), Bytes.toBytes('a'), \
CompareFilter::CompareOp.valueOf('EQUAL'), SubstringComparator.new('154442')), \
LIMIT => 3 }

But when I try to combine two filters like that: 

scan 'rawdb', { COLUMNS => 'raw:a', FILTER =>
"(SingleColumnValueFilter.new(Bytes.toBytes('raw'), Bytes.toBytes('a'), \
CompareFilter::CompareOp.valueOf('EQUAL'), SubstringComparator.new('154442')) \
AND (SingleColumnValueFilter.new(Bytes.toBytes('raw'), Bytes.toBytes('u'), \
CompareFilter::CompareOp.valueOf('EQUAL'), SubstringComparator.new('blafasel')))", \
LIMIT => 3 }

I get the following error: 
java.lang.IllegalArgumentException: Filter Name SingleColumnValueFilter.new not supported

Can somebody tell me what I am doing wrong here?

Best regards,
Arvid

-- 
ThreePiO was right: Let the Wookiee win. 

Re: Combining filters in the HBase shell

Posted by Arvid Warnecke <ar...@nostalgix.org>.
Hello Jean-Marc,

thank you for the ideas. I already tried that.

On Thu, Nov 07, 2013 at 06:55:16AM -0500, Jean-Marc Spaggiari wrote:
> Based on the shell help:
>   hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND (QualifierFilter
> (>=, 'binary:xyz'))) AND (TimestampsFilter ( 123, 456))"}
> 
> Can you try without the ".new" when using multiple filters?
> 
I then get another error:
ERROR: java.lang.IllegalArgumentException: Incorrect filter string SingleColumnValueFilter(Bytes.toBytes('raw')

I then tried to get rid of the Bytes.toBytes but that did not seem to
help either.

> Other option, can you try to define you filters first and then reference
> them on your scan?
> 
I tried that, too. But I wasn't able to make the FilterList work in the
shell. I found examples which seem to work in Java, but in JRuby I can't
make them work. :(

Cheers,
Arvid

-- 
ThreePiO was right: Let the Wookiee win.

Re: Combining filters in the HBase shell

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Hi Arvid,

Based on the shell help:
  hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND (QualifierFilter
(>=, 'binary:xyz'))) AND (TimestampsFilter ( 123, 456))"}

Can you try without the ".new" when using multiple filters?

Other option, can you try to define you filters first and then reference
them on your scan?

JM


2013/11/7 Arvid Warnecke <ar...@nostalgix.org>

> Hello,
>
> I have some issues when I try to use filters in the shell.
> When I use only one filter everything is okay:
>
> scan 'rawdb', { COLUMNS => 'raw:a', FILTER => \
> SingleColumnValueFilter.new(Bytes.toBytes('raw'), Bytes.toBytes('a'), \
> CompareFilter::CompareOp.valueOf('EQUAL'),
> SubstringComparator.new('154442')), \
> LIMIT => 3 }
>
> But when I try to combine two filters like that:
>
> scan 'rawdb', { COLUMNS => 'raw:a', FILTER =>
> "(SingleColumnValueFilter.new(Bytes.toBytes('raw'), Bytes.toBytes('a'), \
> CompareFilter::CompareOp.valueOf('EQUAL'),
> SubstringComparator.new('154442')) \
> AND (SingleColumnValueFilter.new(Bytes.toBytes('raw'), Bytes.toBytes('u'),
> \
> CompareFilter::CompareOp.valueOf('EQUAL'),
> SubstringComparator.new('blafasel')))", \
> LIMIT => 3 }
>
> I get the following error:
> java.lang.IllegalArgumentException: Filter Name
> SingleColumnValueFilter.new not supported
>
> Can somebody tell me what I am doing wrong here?
>
> Best regards,
> Arvid
>
> --
> ThreePiO was right: Let the Wookiee win.
>