[ https://issues.apache.org/jira/browse/HBASE-1264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689409#action_12689409 ]
Thomas Schneider commented on HBASE-1264: ----------------------------------------- Hi Andrew, as in [Comparable.compareTo()|http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html#compareTo(T)] defined, the return values should be 0 if the compared objects equal. In the RegexStringComparator it is the case if the comaperd String matches the pattern. Then the method should return 0. If the String does not match, it should return 1. I found this bug, when is used the RegexStringComparator as Comparator in a [ColumnValueFilter|http://hadoop.apache.org/hbase/docs/current/api/org/apache/hadoop/hbase/filter/ColumnValueFilter.html#constructor_detail] like {{ColumnValueFilter(byte[], ColumnValueFilter.CompareOp, WritableByteArrayComparable)}}. It filtered exactly the opposite values, those who did not match the given regex. But ColumnValueFilter is implemented as positive filter, meaning it returns the values who match the filter (other negative implementations elimate the values matching the filter and return the rest). I tested this behaviour by using the ColumnValueFilter with a simple value comparison like {{ColumnValueFilter(byte[], ColumnValueFilter.CompareOp, byte[])}}. After that I found the non-default return behaviour of the compareTo() method in RegexStringcomparator as cause for the wrong filtering. > Wrong return values of compareTo in > org.apache.hadoop.hbase.filter.RegexStringComparator > ---------------------------------------------------------------------------------------- > > Key: HBASE-1264 > URL: https://issues.apache.org/jira/browse/HBASE-1264 > Project: Hadoop HBase > Issue Type: Bug > Components: filters > Affects Versions: 0.19.1 > Environment: Ubuntu 8.04 (64 Bit), JDK 1.6 > Reporter: Thomas Schneider > Priority: Minor > Fix For: 0.19.1 > > Attachments: hbase-1264.patch > > Original Estimate: 0.08h > Remaining Estimate: 0.08h > > The return values of the compareTo() method have to be changed against each > other. The method has to return 0 if the regex matches and 1 if it does not. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.