Use Spark With the BeakerX Scala Kernel
Posted on Apr 23, 2021 in Computer Science
Things under legendu.net/outdated are outdated technologies that the author does not plan to update any more. Please look for better alternatives.
-
Open a JupyterLab notebook with the BeakerX Scala kernel from the launcher.
-
Download Spark (say, 2.3.1) dependencies.
%%classpath add mvn org.apache.spark spark-core_2.11 2.3.1 org.apache.spark spark-sql_2.11 2.3.1
-
Create a SparkSession object.
import org.apache.spark.sql.SparkSession import org.apache.spark.sql.functions._ val spark = SparkSession.builder() .master("local[2]") .appName("Spark Example") .config("spark.some.config.option", "some-value") .getOrCreate() import spark.implicits._
-
Use Spark as usual.
val df = Range(0, 10).toDF df.show