I would like to initiate the spark context in python from scala.
I have added package 'pyspark' to do this. This is the code which I have tried and this works fine.
Code snippet:
import sys.process._
var os: java.io.OutputStream = _
val python = Process(Seq("python","-i")).run(BasicIO.standard(os = _))
def pushLine(s: String): Unit = {
os.write(s"$s\n".getBytes("UTF-8"))
os.flush()
}
pushLine("from pyspark import SparkContext, SparkConf;from pyspark.sql import SQLContext;conf = SparkConf().setAppName('test').setMaster('local');sc = SparkContext(conf=conf);sqlContext = SQLContext(sc);")
Now, my requirement is to avoid the output stream that gets displayed in scala. Is there any option to avoid this ?
Thanks in advance :)