Repository: spark
Updated Branches:
  refs/heads/branch-1.0 5e85f87ac -> b1c2199bf


SPARK-2148 Add link to requirements for custom equals() and hashcode() methods

https://issues.apache.org/jira/browse/SPARK-2148

Author: Andrew Ash <[email protected]>

Closes #1092 from ash211/SPARK-2148 and squashes the following commits:

93513df [Andrew Ash] SPARK-2148 Add link to requirements for custom equals() 
and hashcode() methods
(cherry picked from commit 9672ee07fb1c3583c70f23a699de3b2282eb0f98)

Signed-off-by: Patrick Wendell <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/b1c2199b
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/b1c2199b
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/b1c2199b

Branch: refs/heads/branch-1.0
Commit: b1c2199bff05b648654fc7219329bae48a91551b
Parents: 5e85f87
Author: Andrew Ash <[email protected]>
Authored: Sun Jun 15 23:32:55 2014 -0700
Committer: Patrick Wendell <[email protected]>
Committed: Sun Jun 15 23:33:34 2014 -0700

----------------------------------------------------------------------
 docs/programming-guide.md | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/b1c2199b/docs/programming-guide.md
----------------------------------------------------------------------
diff --git a/docs/programming-guide.md b/docs/programming-guide.md
index b667aa0..8d4c6b1 100644
--- a/docs/programming-guide.md
+++ b/docs/programming-guide.md
@@ -684,6 +684,11 @@ val counts = pairs.reduceByKey((a, b) => a + b)
 We could also use `counts.sortByKey()`, for example, to sort the pairs 
alphabetically, and finally
 `counts.collect()` to bring them back to the driver program as an array of 
objects.
 
+**Note:** when using custom objects as the key in key-value pair operations, 
you must be sure that a
+custom `equals()` method is accompanied with a matching `hashCode()` method.  
For full details, see
+the contract outlined in the [Object.hashCode()
+documentation](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode()).
+
 </div>
 
 <div data-lang="java" markdown="1">
@@ -716,6 +721,10 @@ JavaPairRDD<String, Integer> counts = 
pairs.reduceByKey((a, b) -> a + b);
 We could also use `counts.sortByKey()`, for example, to sort the pairs 
alphabetically, and finally
 `counts.collect()` to bring them back to the driver program as an array of 
objects.
 
+**Note:** when using custom objects as the key in key-value pair operations, 
you must be sure that a
+custom `equals()` method is accompanied with a matching `hashCode()` method.  
For full details, see
+the contract outlined in the [Object.hashCode()
+documentation](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode()).
 
 </div>
 

Reply via email to