I'm trying to pass a Spark RDD from Scala to Python so that I can then call functions on it from PySpark.
My scala code returns
rdd.toJavaRDD(), which I then read in python via:
scala_res = sc._jvm.com.package.Class.method()
from pyspark.rdd import RDD
python_rdd = RDD(scala_res, sc._sc)
This initially appears to work, but if I call functions on this RDD, like python_rdd.count(), it will start a Spark job to get the result but error out with the error: org.apache.spark.SparkException: Unexpected element type class java.lang.Long.
It seems maybe I'm missing some conversion step from java to python RDD?
I'm using Scala 2.11, and Spark 2.2.0.