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

Reid Chan edited comment on HBASE-19824 at 1/23/18 6:18 AM:
------------------------------------------------------------

There're bugs in {{SingleColumnValueFilter}} 
{code}
  @Override
  public ReturnCode filterCell(final Cell c) {
    // System.out.println("REMOVE KEY=" + keyValue.toString() + ", value=" + 
Bytes.toString(keyValue.getValue()));
    if (this.matchedColumn) {
      // We already found and matched the single column, all keys now pass
      return ReturnCode.INCLUDE;
    } else if (this.latestVersionOnly && this.foundColumn) {
      // We found but did not match the single column, skip to next row
      return ReturnCode.NEXT_ROW;
    }
{code}
this snippet will lead to the phenomenon as Ted described. Since f1:a1:a2 
matched, {{matchedColumn}} is set **true**, the following f1:b1:b2 will be kept 
anyway. (in the same row r1).

Also, in the same method
{code}
  @Override
  public ReturnCode filterCell(final Cell c) {
    ...
    if (!CellUtil.matchingColumn(c, this.columnFamily, this.columnQualifier)) {
      return ReturnCode.INCLUDE;
    }
{code}
this snippet will lead to even a mismatch column will be kept.

Correct me if i'm wrong.


was (Author: reidchan):
There're bugs in {{SingleColumnValueFilter}} 
{code}
  @Override
  public ReturnCode filterCell(final Cell c) {
    // System.out.println("REMOVE KEY=" + keyValue.toString() + ", value=" + 
Bytes.toString(keyValue.getValue()));
    if (this.matchedColumn) {
      // We already found and matched the single column, all keys now pass
      return ReturnCode.INCLUDE;
    } else if (this.latestVersionOnly && this.foundColumn) {
      // We found but did not match the single column, skip to next row
      return ReturnCode.NEXT_ROW;
    }
{code}
this snippet will lead to the phenomenon as Ted described. Since f1:a1:a2 
matched, {{matchedColumn}} is set **true**, the following f1:b1:b2 will be kept 
anyway.

Also, in the same method
{code}
  @Override
  public ReturnCode filterCell(final Cell c) {
    ...
    if (!CellUtil.matchingColumn(c, this.columnFamily, this.columnQualifier)) {
      return ReturnCode.INCLUDE;
    }
{code}
this snippet will lead to even a mismatch column will be kept.

Correct me if i'm wrong.

> SingleColumnValueFilter returns wrong result when used in shell command
> -----------------------------------------------------------------------
>
>                 Key: HBASE-19824
>                 URL: https://issues.apache.org/jira/browse/HBASE-19824
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 2.0.0-alpha-4
>            Reporter: Ted Yu
>            Assignee: Reid Chan
>            Priority: Major
>
> There are two cells in table t1:
> {code}
> ROW                                                         COLUMN+CELL
>  r1                                                         column=f1:a1, 
> timestamp=1516313683984, value=a2
>  r1                                                         column=f1:b1, 
> timestamp=1516313700744, value=b2
> {code}
> When SingleColumnValueFilter is used in shell command, no filtering was done:
> {code}
> hbase(main):022:0> scan 't1', {FILTER => "SingleColumnValueFilter('f1', 'a1', 
> =, 'binary:a2')"}
> ROW                                                         COLUMN+CELL
>  r1                                                         column=f1:a1, 
> timestamp=1516313683984, value=a2
>  r1                                                         column=f1:b1, 
> timestamp=1516313700744, value=b2
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to