[ https://issues.apache.org/jira/browse/HBASE-20565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16471467#comment-16471467 ]
Zheng Hu commented on HBASE-20565: ---------------------------------- Add some log by debug.diff, and the result is shown in debug.log. I think the bug is not from FilterList, but is from ColumnPaginationFilter#filterKeyValue. {code} public ReturnCode filterKeyValue(Cell v) { if (columnOffset != null) { if (count >= limit) { return ReturnCode.NEXT_ROW; } byte[] buffer = v.getQualifierArray(); if (buffer == null) { return ReturnCode.SEEK_NEXT_USING_HINT; } int cmp = 0; // Only compare if no KV's have been seen so far. if (count == 0) { cmp = Bytes.compareTo(buffer, v.getQualifierOffset(), v.getQualifierLength(), this.columnOffset, 0, this.columnOffset.length); } if (cmp < 0) { return ReturnCode.SEEK_NEXT_USING_HINT; } else { count++; return ReturnCode.INCLUDE_AND_NEXT_COL; } } else { if (count >= offset + limit) { return ReturnCode.NEXT_ROW; } ReturnCode code = count < offset ? ReturnCode.NEXT_COL : ReturnCode.INCLUDE_AND_NEXT_COL; count++; <------------------- the count increment even if return NEXT_COL. return code; } } {code} The count increment even if we return NEXT_COL, so after the filter checked the column=Family:0, count=1, when filter is checking the column=Family:5, the count is 5 now, so return a NEXT_ROW... we should define our count as the number of included column in ColumnPaginationFilter (just as the def in if (columnOffset != null) {} ), rather than the index of column we encountered. .. > ColumnRangeFilter combined with ColumnPaginationFilter can produce incorrect > result since 1.4 > --------------------------------------------------------------------------------------------- > > Key: HBASE-20565 > URL: https://issues.apache.org/jira/browse/HBASE-20565 > Project: HBase > Issue Type: Bug > Components: Filters > Affects Versions: 1.4.4 > Reporter: Jerry He > Assignee: Zheng Hu > Priority: Major > Attachments: debug.diff, debug.log, test-branch-1.4.patch > > > When ColumnPaginationFilter is combined with ColumnRangeFilter, we may see > incorrect result. > Here is a simple example. > One row with 10 columns c0, c1, c2, .., c9. I have a ColumnRangeFilter for > range c2 to c9. Then I have a ColumnPaginationFilter with limit 5 and offset > 0. FileterList is FilterList(Operator.MUST_PASS_ALL, ColumnRangeFilter, > ColumnPaginationFilter). > We expect 5 columns being returned. But in HBase 1.4 and after, 4 columns > are returned. > In 1.2.x, the correct 5 columns are returned. -- This message was sent by Atlassian JIRA (v7.6.3#76005)