[ 
https://issues.apache.org/jira/browse/HBASE-4364?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13435775#comment-13435775
 ] 

Jie Huang commented on HBASE-4364:
----------------------------------

I have updated the patch file against the latest trunk version. This patch only 
aims to solve the problem which is stated in this bug entry. So that the user 
can do sth. like 
{noformat}
create 't2', 'f'
put 't2', 'r1', 'f:e_word', 'hello'
put 't2', 'r1', 'f:f_word', 'bonjour'
put 't2', 'r2', 'f:e_word', 'goodbye'
put 't2', 'r2', 'f:f_word', 'au revoir'
# scan with a predicate of the french word > 'b', selecting only the english 
word
# it only returns "r1 column=f:e_word, value=hello" instead of 
# "r1 column=f:e_word, value=hello; r2 column=f:e_word, value=goodbye"
scan 't2', { COLUMNS => ['f:e_word'], FILTER => "SingleColumnValueFilter('f', 
'f_word', >, 'binary:b')"  }
{noformat}

>From my perspective, this case is different with that case stated in the 
>unit-test file. Here is a simple solution to make that unit-test case passed. 
{code}
 private static class ValueHasMoreThan2BytesFilter extends FilterBase {
    @Override
    public ReturnCode filterKeyValue(KeyValue kv) {
      byte[] val = kv.getValue();
      if (val.length > 2) {
        return ReturnCode.INCLUDE;
      } else {
        return ReturnCode.NEXT_ROW; // it should be "return ReturnCode.SKIP;"
      }
    }
{code} 

Then we can get the expected results here.
                
> Filters applied to columns not in the selected column list are ignored
> ----------------------------------------------------------------------
>
>                 Key: HBASE-4364
>                 URL: https://issues.apache.org/jira/browse/HBASE-4364
>             Project: HBase
>          Issue Type: Bug
>          Components: filters
>    Affects Versions: 0.90.4, 0.92.0, 0.94.0
>            Reporter: Todd Lipcon
>            Priority: Critical
>         Attachments: 
> HBASE-4364-failing-test-with-simplest-custom-filter.patch, 
> hbase-4364_trunk.patch, hbase-4364_trunk-v2.patch
>
>
> For a scan, if you select some set of columns using addColumns(), and then 
> apply a SingleColumnValueFilter that restricts the results based on some 
> other columns which aren't selected, then those filter conditions are ignored.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to