File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
core/src/main/scala/org/apache/spark/rdd Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ package org.apache.spark.rdd
2020import java .util .Random
2121
2222import scala .collection .Map
23- import scala .collection .JavaConversions .mapAsScalaMap
2423import scala .collection .mutable .ArrayBuffer
2524import scala .reflect .{classTag , ClassTag }
2625
@@ -848,7 +847,10 @@ abstract class RDD[T: ClassTag](
848847 m1
849848 }
850849 val myResult = mapPartitions(countPartition).reduce(mergeMaps)
851- myResult.asInstanceOf [java.util.Map [T , Long ]] // Will be wrapped as a Scala mutable Map
850+ // Convert to a Scala mutable map
851+ val mutableResult = scala.collection.mutable.Map [T ,Long ]()
852+ myResult.foreach { case (k, v) => mutableResult.put(k, v) }
853+ mutableResult
852854 }
853855
854856 /**
You can’t perform that action at this time.
0 commit comments