hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From schnitzi <mark.schnitz...@fastsearch.com>
Subject Re: ColumnValueFilter issue
Date Wed, 24 Jun 2009 06:01:16 GMT

No, that's not correct - ColumnValueFilters are fine for comparing a column
against a fixed value, and in fact, that's how I'm using them.  The issue is
that when you call getScanner(...), the first parameter you give it is just
the list of columns that you're interested in.  If this list does not
include the column that you are testing in your ColumnValueFilter (passed
into getScanner(...) via a different parameter), then you will get no
results back at all.

In fact, I don't think there's any way to use filters to compare one column
against another.  I suspect that you would have to do two passes.

If anyone's interested - I just had a situation where I needed to find all
the rows that had NO value for a particular column.  After some
experimentation, this was the filter I needed to add:

   new ColumnValueFilter(myColumn, ColumnValueFilter.CompareOp.EQUAL,
NONEXISTENT_TAG_KEY, false)

where NONEXISTENT_TAG_KEY is a value that I know would never appear in that
column.



cambridgemike wrote:
> 
> So ColumnValueFilters are only used for comparing two columns against each
> other? As opposed to comparing a column against a fixed value ('foo' in
> your
> case)? If this is the case, what is the preferred method for accomplishing
> the latter.
> 
> -Mike
> 
> On Fri, Jun 19, 2009 at 1:50 AM, schnitzi
> <mark.schnitzius@fastsearch.com>wrote:
> 
>>
>> Isn't it always the way?  As soon as you post a question to a forum, you
>> figure out the answer...
>>
>> For the benefit of future generations, the first 'columns' parameter to
>> getScanner(...) needs to include the column you are comparing on, if
>> you're
>> using a ColumnValueFilter.  I thought you would only need to include the
>> columns you were subsequently interested in seeing in the results.
>>
>> It would be nice to see an exception generated for this, instead of just
>> no
>> results...
>>
>>
>>
>> schnitzi wrote:
>> >
>> > I'm using HBase 0.19.3, and seeing some unusual behavior around
>> > ColumnValueFilter.  When I do this...
>> >
>> >     Scanner scanner = myTable.getScanner(COLUMN1, startKey);
>> >
>> > ...I get three results.  But if I do...
>> >
>> >     Scanner scanner = myTable.getScanner(COLUMN1, startKey, new
>> > ColumnValueFilter(COL1,
>> >                 ColumnValueFilter.CompareOp.NOT_EQUAL,
>> > Bytes.toBytes("foo")));
>> >
>> > ...I get no results, where I would expect three.  But even if I change
>> > NOT_EQUAL to EQUAL....
>> >
>> >     Scanner scanner = myTable.getScanner(COLUMN1, startKey, new
>> > ColumnValueFilter(COL1,
>> >                 ColumnValueFilter.CompareOp.EQUAL,
>> Bytes.toBytes("foo")));
>> >
>> > ...I get no results.  Is there something about ColumnValueFilter I'm
>> not
>> > understanding?  I would expect either EQUAL or NOT_EQUAL to return
>> > *something*...
>> >
>> >
>> > Thanks
>> > Mark
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/ColumnValueFilter-issue-tp24105833p24105876.html
>> Sent from the HBase User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/ColumnValueFilter-issue-tp24105833p24179154.html
Sent from the HBase User mailing list archive at Nabble.com.


Mime
View raw message