Skip to content

Commit 931b587

Browse files
committed
Use abstract class instead of trait for binary compatibility
1 parent 9ba4ec4 commit 931b587

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

graphx/src/main/scala/org/apache/spark/graphx/EdgeRDD.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ package org.apache.spark.graphx
1919

2020
import scala.reflect.ClassTag
2121

22+
import org.apache.spark.Dependency
23+
import org.apache.spark.SparkContext
2224
import org.apache.spark.rdd.RDD
2325
import org.apache.spark.storage.StorageLevel
2426

@@ -32,7 +34,9 @@ import org.apache.spark.graphx.impl.EdgeRDDImpl
3234
* edge to provide the triplet view. Shipping of the vertex attributes is managed by
3335
* `impl.ReplicatedVertexView`.
3436
*/
35-
trait EdgeRDD[@specialized ED, VD] extends RDD[Edge[ED]] {
37+
abstract class EdgeRDD[@specialized ED, VD](
38+
@transient sc: SparkContext,
39+
@transient deps: Seq[Dependency[_]]) extends RDD[Edge[ED]](sc, deps) {
3640
/**
3741
* Map the values in an edge partitioning preserving the structure but changing the values.
3842
*

graphx/src/main/scala/org/apache/spark/graphx/VertexRDD.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ import org.apache.spark.graphx.impl.VertexRDDFunctions._
5656
*
5757
* @tparam VD the vertex attribute associated with each vertex in the set.
5858
*/
59-
trait VertexRDD[@specialized VD] extends RDD[(VertexId, VD)] {
59+
abstract class VertexRDD[@specialized VD](
60+
@transient sc: SparkContext,
61+
@transient deps: Seq[Dependency[_]]) extends RDD[(VertexId, VD)](sc, deps) {
6062

6163
implicit protected def vdTag: ClassTag[VD]
6264

@@ -81,8 +83,8 @@ trait VertexRDD[@specialized VD] extends RDD[(VertexId, VD)] {
8183
* preserves the index for efficient joins with the original RDD, and it sets bits in the bitmask
8284
* rather than allocating new memory.
8385
*
84-
* It is declared and defined in the VertexRDD trait to allow refining the return type from
85-
* `RDD[(VertexId, VD)]` to `VertexRDD[VD]`.
86+
* It is declared and defined here to allow refining the return type from `RDD[(VertexId, VD)]` to
87+
* `VertexRDD[VD]`.
8688
*
8789
* @param pred the user defined predicate, which takes a tuple to conform to the
8890
* `RDD[(VertexId, VD)]` interface

graphx/src/main/scala/org/apache/spark/graphx/impl/EdgeRDDImpl.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ import org.apache.spark.graphx._
2828
class EdgeRDDImpl[@specialized ED: ClassTag, VD: ClassTag] private[graphx] (
2929
override val partitionsRDD: RDD[(PartitionID, EdgePartition[ED, VD])],
3030
val targetStorageLevel: StorageLevel = StorageLevel.MEMORY_ONLY)
31-
extends RDD[Edge[ED]](partitionsRDD.context, List(new OneToOneDependency(partitionsRDD)))
32-
with EdgeRDD[ED, VD] {
31+
extends EdgeRDD[ED, VD](partitionsRDD.context, List(new OneToOneDependency(partitionsRDD))) {
3332

3433
override def setName(_name: String): this.type = {
3534
if (partitionsRDD.name != null) {

graphx/src/main/scala/org/apache/spark/graphx/impl/VertexRDDImpl.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ class VertexRDDImpl[@specialized VD] private[graphx] (
3232
val partitionsRDD: RDD[ShippableVertexPartition[VD]],
3333
val targetStorageLevel: StorageLevel = StorageLevel.MEMORY_ONLY)
3434
(implicit override protected val vdTag: ClassTag[VD])
35-
extends RDD[(VertexId, VD)](partitionsRDD.context, List(new OneToOneDependency(partitionsRDD)))
36-
with VertexRDD[VD] {
35+
extends VertexRDD[VD](partitionsRDD.context, List(new OneToOneDependency(partitionsRDD))) {
3736

3837
require(partitionsRDD.partitioner.isDefined)
3938

0 commit comments

Comments
 (0)