hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrzej Bialecki ...@getopt.org>
Subject Re: [jira] Commented: (HADOOP-2365) Result of HashFunction.hash() contains all identical values
Date Thu, 06 Dec 2007 17:52:21 GMT
Jim Kellerman (JIRA) wrote:
>     [ https://issues.apache.org/jira/browse/HADOOP-2365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549100
] 
> 
> Jim Kellerman commented on HADOOP-2365:
> ---------------------------------------
> 
> -1 on patch. This section of code should read:
> 
> {code}
> int[] result = new int[nbHash];
> for (int i = 0, initval = 0; i < nbHash; i++) {
>    initval = result[i] = Math.abs(JenkinsHash.hash(b, initval)) % maxValue;
> }
> return result;
> {code}
> 

Yes, this works too - it shouldn't matter in this specific case. 
Jenkins' hash has very good avalanche behavior, so even 1 bit difference 
in the initvalue yields a completely different hash.


> However, thanks for finding my stupid mistake.

You're welcome. I'm using this class in a different Hadoop application, 
where the problem became immediately apparent when I switched from my 
home-grown BloomFilter implementation to this one.

-- 
Best regards,
Andrzej Bialecki     <><
  ___. ___ ___ ___ _ _   __________________________________
[__ || __|__/|__||\/|  Information Retrieval, Semantic Web
___|||__||  \|  ||  |  Embedded Unix, System Integration
http://www.sigram.com  Contact: info at sigram dot com


Mime
View raw message