-
Notifications
You must be signed in to change notification settings - Fork 5
Description
With ijava, the following will set up spark:
"IJAVA_STARTUP_SCRIPT":"import org.apache.spark.; import org.apache.spark.sql.; import org.apache.spark.api.java.; import org.apache.spark.ml.linalg.; import org.apache.spark.sql.types.; import org.apache.spark.mllib.random.; SparkConf conf = null; JavaSparkContext jsc = null; SparkSession spark = null; SparkContext sc = null; class initspark{ public static void init() { String appName = "app"; String master = "local[4]"; conf = new SparkConf().setAppName(appName).setMaster(master); jsc = new JavaSparkContext(conf); spark=SparkSession.builder().sparkContext(jsc.sc()).master(master).getOrCreate(); sc=jsc.sc(); } }; "
It doesn't work with jjava. I'm not clear why not.
The closest I could come is the following
"IJAVA_STARTUP_SCRIPT":"import org.apache.spark.; import org.apache.spark.sql.; import org.apache.spark.api.java.; import org.apache.spark.ml.linalg.; import org.apache.spark.sql.types.; import org.apache.spark.mllib.random.; SparkConf conf = null; JavaSparkContext jsc = null; SparkSession spark = null; SparkContext sc = null; class initspark{ public static void init() { String appName = "app"; String master = "local[4]"; conf = new SparkConf().setAppName(appName).setMaster(master); jsc = new JavaSparkContext(conf); spark=SparkSession.builder().sparkContext(jsc.sc()).master(master).getOrCreate(); sc=jsc.sc(); } }; "
the `user than has to type "initspark.init()"