From: <tho...@us...> - 2010-08-12 16:49:31
|
Revision: 3441 http://bigdata.svn.sourceforge.net/bigdata/?rev=3441&view=rev Author: thompsonbry Date: 2010-08-12 16:49:25 +0000 (Thu, 12 Aug 2010) Log Message: ----------- Bug fix to SPO.hashCode() per https://sourceforge.net/apps/trac/bigdata/ticket/141. The historical behavior of SPO.hashCode() was based on the int64 term identifiers. Since the hash code is now computed from the int32 hash codes of the (s,p,o) IV objects, the original bit math was resulting in a hash code which was always zero (any 32 bit value shifted right by 32 bits is zero). The change was to remove the bit math. Modified Paths: -------------- trunk/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPO.java Modified: trunk/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPO.java =================================================================== --- trunk/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPO.java 2010-08-11 16:14:01 UTC (rev 3440) +++ trunk/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPO.java 2010-08-12 16:49:25 UTC (rev 3441) @@ -556,11 +556,18 @@ final int p = this.p.hashCode(); final int o = this.o.hashCode(); - - // Note: historical behavior was (s,p,o) based hash. - hashCode = 961 * ((int) (s ^ (s >>> 32))) + 31 - * ((int) (p ^ (p >>> 32))) + ((int) (o ^ (o >>> 32))); + /* + * Note: The historical behavior was based on the int64 term + * identifiers. Since the hash code is now computed from the int32 + * hash codes of the (s,p,o) IV objects, the original bit math was + * resulting in a hash code which was always zero (any 32 bit value + * shifted right by 32 bits is zero). + */ + hashCode = 961 * s + 31 * p + o; +// hashCode = 961 * ((int) (s ^ (s >>> 32))) + 31 +// * ((int) (p ^ (p >>> 32))) + ((int) (o ^ (o >>> 32))); + } return hashCode; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |