You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "sindy (JIRA)" <ji...@apache.org> on 2010/11/11 04:30:27 UTC

[jira] Created: (HBASE-3226) control condition error in hbase.filter.CompareFilter.doCompare

control condition error in hbase.filter.CompareFilter.doCompare  
-----------------------------------------------------------------

                 Key: HBASE-3226
                 URL: https://issues.apache.org/jira/browse/HBASE-3226
             Project: HBase
          Issue Type: Bug
          Components: client
    Affects Versions: 0.20.5
            Reporter: sindy


It exists in HBase 0.20.5 , and also exist in TRUNK
org.apache.hadoop.hbase.filter.CompareFilter.doCompare(CompareOp, WritableByteArrayComparable, byte[], int, int),
  ---------------------------------------------
  switch (compareOp) {
      case LESS:
        return compareResult <= 0;   
      case LESS_OR_EQUAL:     
        return compareResult < 0;
      case EQUAL:
        return compareResult != 0;
      case NOT_EQUAL:
        return compareResult == 0;
      case GREATER_OR_EQUAL:
        return compareResult > 0;
      case GREATER:
        return compareResult >= 0;
      default:
        throw new RuntimeException("Unknown Compare op " +
          compareOp.name());
    }
-----------------------------------------------------
!!! modified code:
    switch (compareOp) {
      case LESS:
        return compareResult < 0;
      case LESS_OR_EQUAL:
        return compareResult <= 0;
      case EQUAL:
        return compareResult == 0;
      case NOT_EQUAL:
        return compareResult != 0;
      case GREATER_OR_EQUAL:
        return compareResult >= 0;
      case GREATER:
        return compareResult >0;
      default:
        throw new RuntimeException("Unknown Compare op " +
          compareOp.name());
    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HBASE-3226) control condition error in hbase.filter.CompareFilter.doCompare

Posted by "stack (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930931#action_12930931 ] 

stack commented on HBASE-3226:
------------------------------

Sindy, it seems strange that you have to adjust nearly all of these operators.  Over in TestFromClientSide, there are tests that make use of CompareFilter operations and they seem to be doing the right thing.  Or are they?  Would you mind checking into these tests?  Maybe they are not written properly or failing that, any chance of some code to demonstrate the breakage you are fixing and how the above fixes it?

Thanks.

> control condition error in hbase.filter.CompareFilter.doCompare  
> -----------------------------------------------------------------
>
>                 Key: HBASE-3226
>                 URL: https://issues.apache.org/jira/browse/HBASE-3226
>             Project: HBase
>          Issue Type: Bug
>          Components: client
>    Affects Versions: 0.20.5
>            Reporter: sindy
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> It exists in HBase 0.20.5 , and also exist in TRUNK
> org.apache.hadoop.hbase.filter.CompareFilter.doCompare(CompareOp, WritableByteArrayComparable, byte[], int, int),
>   ---------------------------------------------
>   switch (compareOp) {
>       case LESS:
>         return compareResult <= 0;   
>       case LESS_OR_EQUAL:     
>         return compareResult < 0;
>       case EQUAL:
>         return compareResult != 0;
>       case NOT_EQUAL:
>         return compareResult == 0;
>       case GREATER_OR_EQUAL:
>         return compareResult > 0;
>       case GREATER:
>         return compareResult >= 0;
>       default:
>         throw new RuntimeException("Unknown Compare op " +
>           compareOp.name());
>     }
> -----------------------------------------------------
> !!! modified code:
>     switch (compareOp) {
>       case LESS:
>         return compareResult < 0;
>       case LESS_OR_EQUAL:
>         return compareResult <= 0;
>       case EQUAL:
>         return compareResult == 0;
>       case NOT_EQUAL:
>         return compareResult != 0;
>       case GREATER_OR_EQUAL:
>         return compareResult >= 0;
>       case GREATER:
>         return compareResult >0;
>       default:
>         throw new RuntimeException("Unknown Compare op " +
>           compareOp.name());
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HBASE-3226) control condition error in hbase.filter.CompareFilter.doCompare

Posted by "sindy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12931323#action_12931323 ] 

sindy commented on HBASE-3226:
------------------------------

 the switch-case  logic seem strange, for example:
 case EQUAL:
         return compareResult != 0;
 case NOT_EQUAL:
         return compareResult == 0;
I made a new project  to test just  the *doCompare ,* it didn't make the
correct result.
but from the hbase-client side test, it made the right result.
 It should have  more precessing relation behind  *doCompare*, I will keep
on it.
Thanks~

2010/11/11 stack (JIRA) <ji...@apache.org>



-- 
Sindy Wang


> control condition error in hbase.filter.CompareFilter.doCompare  
> -----------------------------------------------------------------
>
>                 Key: HBASE-3226
>                 URL: https://issues.apache.org/jira/browse/HBASE-3226
>             Project: HBase
>          Issue Type: Bug
>          Components: client
>    Affects Versions: 0.20.5
>            Reporter: sindy
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> It exists in HBase 0.20.5 , and also exist in TRUNK
> org.apache.hadoop.hbase.filter.CompareFilter.doCompare(CompareOp, WritableByteArrayComparable, byte[], int, int),
>   ---------------------------------------------
>   switch (compareOp) {
>       case LESS:
>         return compareResult <= 0;   
>       case LESS_OR_EQUAL:     
>         return compareResult < 0;
>       case EQUAL:
>         return compareResult != 0;
>       case NOT_EQUAL:
>         return compareResult == 0;
>       case GREATER_OR_EQUAL:
>         return compareResult > 0;
>       case GREATER:
>         return compareResult >= 0;
>       default:
>         throw new RuntimeException("Unknown Compare op " +
>           compareOp.name());
>     }
> -----------------------------------------------------
> !!! modified code:
>     switch (compareOp) {
>       case LESS:
>         return compareResult < 0;
>       case LESS_OR_EQUAL:
>         return compareResult <= 0;
>       case EQUAL:
>         return compareResult == 0;
>       case NOT_EQUAL:
>         return compareResult != 0;
>       case GREATER_OR_EQUAL:
>         return compareResult >= 0;
>       case GREATER:
>         return compareResult >0;
>       default:
>         throw new RuntimeException("Unknown Compare op " +
>           compareOp.name());
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.