Skip to content

Commit

Permalink
Java to python
Browse files Browse the repository at this point in the history
  • Loading branch information
ahirreddy committed Apr 15, 2014
1 parent ab6025d commit bcc0f23
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import java.util.{List => JList, ArrayList => JArrayList, Map => JMap, Collectio
import scala.collection.JavaConversions._
import scala.reflect.ClassTag

import net.razorvine.pickle.Unpickler
import net.razorvine.pickle.{Pickler, Unpickler}

import org.apache.spark._
import org.apache.spark.api.java.{JavaSparkContext, JavaPairRDD, JavaRDD}
Expand Down Expand Up @@ -294,6 +294,15 @@ private[spark] object PythonRDD {
}
}
}

def javaToPython(jRDD: JavaRDD[Any]): JavaRDD[Array[Byte]] = {
jRDD.rdd.mapPartitions { iter =>
val unpickle = new Pickler
iter.map { row =>
unpickle.dumps(row)
}
}
}
}

private
Expand Down

0 comments on commit bcc0f23

Please sign in to comment.