SparkSession
The entry point into all functionality in Spark SQL is the SparkSession class. If you use spark-shell, SparkSession is automatically created for you.
Otherwise, you will need to create SparkSesison:
1
import org.apache.spark.sql.SparkSession
2
val spark = SparkSession
3
.builder
4
.appName("SQL example")
5
.master("local[*]")
6
.config("spark.sql.warehouse.dir", "file:///d:/tmp")
7
.getOrCreate()
Copied!
SparkSession is required for runing Spark SQL query.
Last modified 1yr ago
Copy link