File tree Expand file tree Collapse file tree 3 files changed +5
-20
lines changed
core/src/main/scala/org/apache/spark/rdd
streaming/src/main/scala/org/apache/spark/streaming/dstream Expand file tree Collapse file tree 3 files changed +5
-20
lines changed Original file line number Diff line number Diff line change @@ -568,11 +568,7 @@ abstract class RDD[T: ClassTag](
568568 * times (use `.distinct()` to eliminate them).
569569 */
570570 def union (other : RDD [T ]): RDD [T ] = withScope {
571- if (partitioner.isDefined && other.partitioner == partitioner) {
572- new PartitionerAwareUnionRDD (sc, Array (this , other))
573- } else {
574- new UnionRDD (sc, Array (this , other))
575- }
571+ sc.union(this , other)
576572 }
577573
578574 /**
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ import scala.collection.mutable.ArrayBuffer
2121import scala .reflect .ClassTag
2222
2323import org .apache .spark .SparkException
24- import org .apache .spark .rdd .{ RDD , UnionRDD , PartitionerAwareUnionRDD }
24+ import org .apache .spark .rdd .RDD
2525import org .apache .spark .streaming .{Duration , Time }
2626
2727private [streaming]
@@ -45,11 +45,7 @@ class UnionDStream[T: ClassTag](parents: Array[DStream[T]])
4545 s " time $validTime" )
4646 }
4747 if (rdds.nonEmpty) {
48- if (rdds.forall(_.partitioner.isDefined) && rdds.flatMap(_.partitioner).toSet.size == 1 ) {
49- Some (new PartitionerAwareUnionRDD (ssc.sc, rdds))
50- } else {
51- Some (new UnionRDD (ssc.sc, rdds))
52- }
48+ Some (ssc.sc.union(rdds))
5349 } else {
5450 None
5551 }
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ package org.apache.spark.streaming.dstream
1919
2020import scala .reflect .ClassTag
2121
22- import org .apache .spark .rdd .{ PartitionerAwareUnionRDD , RDD , UnionRDD }
22+ import org .apache .spark .rdd .RDD
2323import org .apache .spark .storage .StorageLevel
2424import org .apache .spark .streaming ._
2525import org .apache .spark .streaming .Duration
@@ -63,13 +63,6 @@ class WindowedDStream[T: ClassTag](
6363 override def compute (validTime : Time ): Option [RDD [T ]] = {
6464 val currentWindow = new Interval (validTime - windowDuration + parent.slideDuration, validTime)
6565 val rddsInWindow = parent.slice(currentWindow)
66- val windowRDD = if (rddsInWindow.flatMap(_.partitioner).distinct.length == 1 ) {
67- logDebug(" Using partition aware union for windowing at " + validTime)
68- new PartitionerAwareUnionRDD (ssc.sc, rddsInWindow)
69- } else {
70- logDebug(" Using normal union for windowing at " + validTime)
71- new UnionRDD (ssc.sc, rddsInWindow)
72- }
73- Some (windowRDD)
66+ Some (ssc.sc.union(rddsInWindow))
7467 }
7568}
You can’t perform that action at this time.
0 commit comments