You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by schnitzi <ma...@fastsearch.com> on 2009/06/19 07:43:02 UTC
ColumnValueFilter issue
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-tp24105833p24105833.html
Sent from the HBase User mailing list archive at Nabble.com.
Re: ColumnValueFilter issue
Posted by stack <st...@duboce.net>.
Any chance of a patch that throws an exception?
St.Ack
On Thu, Jun 18, 2009 at 10:50 PM, schnitzi
<ma...@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.
>
>
Re: ColumnValueFilter issue
Posted by schnitzi <ma...@fastsearch.com>.
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
> <ma...@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.
Re: ColumnValueFilter issue
Posted by mike anderson <sa...@gmail.com>.
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 <ma...@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.
>
>
Re: ColumnValueFilter issue
Posted by schnitzi <ma...@fastsearch.com>.
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.