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

Ashish Singhi commented on HBASE-14491:
---------------------------------------

bq. {{lastCell = cells.get(I) }} should be append after distinctRowKeys++ ?
No, that is still wrong. 
It will fail in this case (1,2,1,2,5), it will output the count as 5.

I think we should do something like this,
1) Create a temp list
2) Iterate over the original list and retrieve the element
3) If the temp list does not contain the element, add element to it and finally 
return the size of this list.

> ReplicationSource#countDistinctRowKeys code logic is not correct
> ----------------------------------------------------------------
>
>                 Key: HBASE-14491
>                 URL: https://issues.apache.org/jira/browse/HBASE-14491
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Ashish Singhi
>            Assignee: Ashish Singhi
>            Priority: Minor
>
> {code}
>       Cell lastCell = cells.get(0);
>       for (int i = 0; i < edit.size(); i++) {
>         if (!CellUtil.matchingRow(cells.get(i), lastCell)) {
>           distinctRowKeys++;
>         }
>       }
> {code}
> The above logic for finding the distinct row keys in the list needs to be 
> corrected.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to