diff options
author | Joan <joan@goyeau.com> | 2016-04-22 12:24:12 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-04-22 12:24:12 +0100 |
commit | bf95b8da2774620cd62fa36bd8bf37725ad3fc7d (patch) | |
tree | b257a13641f72ed5b0b0eff34ef0bf64374c7c1d /streaming/src/main/scala/org | |
parent | e09ab5da8b02da98d7b2496d549c1d53cceb8728 (diff) | |
download | spark-bf95b8da2774620cd62fa36bd8bf37725ad3fc7d.tar.gz spark-bf95b8da2774620cd62fa36bd8bf37725ad3fc7d.tar.bz2 spark-bf95b8da2774620cd62fa36bd8bf37725ad3fc7d.zip |
[SPARK-6429] Implement hashCode and equals together
## What changes were proposed in this pull request?
Implement some `hashCode` and `equals` together in order to enable the scalastyle.
This is a first batch, I will continue to implement them but I wanted to know your thoughts.
Author: Joan <joan@goyeau.com>
Closes #12157 from joan38/SPARK-6429-HashCode-Equals.
Diffstat (limited to 'streaming/src/main/scala/org')
-rw-r--r-- | streaming/src/main/scala/org/apache/spark/streaming/rdd/MapWithStateRDD.scala | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/streaming/src/main/scala/org/apache/spark/streaming/rdd/MapWithStateRDD.scala b/streaming/src/main/scala/org/apache/spark/streaming/rdd/MapWithStateRDD.scala index 8119d808ff..58b7031d5e 100644 --- a/streaming/src/main/scala/org/apache/spark/streaming/rdd/MapWithStateRDD.scala +++ b/streaming/src/main/scala/org/apache/spark/streaming/rdd/MapWithStateRDD.scala @@ -84,15 +84,19 @@ private[streaming] object MapWithStateRDDRecord { * RDD, and a partitioned keyed-data RDD */ private[streaming] class MapWithStateRDDPartition( - idx: Int, + override val index: Int, @transient private var prevStateRDD: RDD[_], @transient private var partitionedDataRDD: RDD[_]) extends Partition { private[rdd] var previousSessionRDDPartition: Partition = null private[rdd] var partitionedDataRDDPartition: Partition = null - override def index: Int = idx - override def hashCode(): Int = idx + override def hashCode(): Int = index + + override def equals(other: Any): Boolean = other match { + case that: MapWithStateRDDPartition => index == that.index + case _ => false + } @throws(classOf[IOException]) private def writeObject(oos: ObjectOutputStream): Unit = Utils.tryOrIOException { |