lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dawid Weiss (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-4919) IntsRef, BytesRef and CharsRef return incorrect hashcode when filled with 0
Date Tue, 09 Apr 2013 11:02:16 GMT

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

Dawid Weiss commented on LUCENE-4919:
-------------------------------------

This isn't a bug, it's a definition like any other. In general any definition of hash(X),
even hash(X) = 42 is also valid (obviously with poor space-distributing properties...). The
question which particular hash function to pick and what inputs it should consume (number
of elements, values of elements) is kind of difficult -- when you include more elements into
computations the distribution for certain inputs may be better but you'll probably loose some
performance on the average case.

                
> IntsRef, BytesRef and CharsRef return incorrect hashcode when filled with 0
> ---------------------------------------------------------------------------
>
>                 Key: LUCENE-4919
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4919
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/other
>    Affects Versions: 4.2
>            Reporter: Renaud Delbru
>             Fix For: 4.3
>
>         Attachments: LUCENE-4919.patch
>
>
> IntsRef, BytesRef and CharsRef implementation do not follow the java Arrays.hashCode
implementation, and return incorrect hashcode when filled with 0. 
> For example, an IntsRef with \{ 0 \} will return the same hashcode than an IntsRef with
\{ 0, 0 \}.

--
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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message