You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@giraph.apache.org by "Avery Ching (JIRA)" <ji...@apache.org> on 2012/11/29 20:58:58 UTC

[jira] [Commented] (GIRAPH-424) Fix hashCode modulo computation

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

Avery Ching commented on GIRAPH-424:
------------------------------------

I'm a bit confused about the need for this?

-    return partitionOwnerList.get(Math.abs(vertexId.hashCode()) %
-        partitionOwnerList.size());
+    return partitionOwnerList.get(
+        Math.abs(vertexId.hashCode() % partitionOwnerList.size()));

In both cases, the result will be positive, what is the problem we are trying to fix?
                
> Fix hashCode modulo computation
> -------------------------------
>
>                 Key: GIRAPH-424
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-424
>             Project: Giraph
>          Issue Type: Bug
>            Reporter: Maja Kabiljo
>            Assignee: Maja Kabiljo
>         Attachments: GIRAPH-424.patch
>
>
> hashCode() can return Integer.MIN_VALUE, and on several places we do Math.abs(hashCode), expecting to get a positive value.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira