You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Alok Singh (JIRA)" <ji...@apache.org> on 2015/06/26 01:24:04 UTC

[jira] [Created] (SPARK-8647) Potential issues with the constant hashCode

Alok Singh created SPARK-8647:
---------------------------------

             Summary: Potential issues with the constant hashCode 
                 Key: SPARK-8647
                 URL: https://issues.apache.org/jira/browse/SPARK-8647
             Project: Spark
          Issue Type: Bug
          Components: MLlib
    Affects Versions: 1.4.0
            Reporter: Alok Singh
            Priority: Minor


Hi,

This may be potential bug or performance issue or just the code docs.

The issue is wrt to MatrixUDT class.
 If we decide to put instance of MatrixUDT into the hash based collection.
The hashCode function is returning constant and even though equals method is consistant with hashCode. I don't see the reason why hashCode() = 1994 (i.e constant) has been used.

I was expecting it to be similar to the other matrix class or the vector class .

If there is the reason why we have this code, we should document it properly in the code so that others reading it is fine.

regards,
Alok

Details
=====
a)
In reference to the file 
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala

line 188-197 ie

 override def equals(o: Any): Boolean = {
o match {
case v: MatrixUDT => true
case _ => false
}
}
override def hashCode(): Int = 1994

b) the commit is 
https://github.com/apache/spark/commit/11e025956be3818c00effef0d650734f8feeb436
on March 20.





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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org