Question: How can I create the sparksession?

```
scala> import org.apache.spark.SparkConf
import org.apache.spark.SparkConf

scala>    import org.apache.spark.SparkContext 
import org.apache.spark.SparkContext

scala> val conf = SparkSession.builder.master("local").appName("testing").enableHiveSupport().getOrCreate()  

<console>:27: error: not found: value SparkSession
         val conf = SparkSession.builder.master("local").appName("testing").enableHiveSupport().getOrCreate()

```

Answer: 
SparkSession is available in spark 2.x

```
import org.apache.spark.sql.SparkSession

```

Though when you start spark shell SparkSession is already available as `spark` variable.
Scala Spark:

```
import org.apache.spark.sql.SparkSession
val conf = SparkSession.builder.master("local").appName("testing").enableHiveSupport().getOrCreate()  

```

PySpark:

```
from pyspark.sql import SparkSession
spark = SparkSession.builder \
 .appName("testing") \
 .enableHiveSupport() \
 .getOrCreate()

```

Add `.config("spark.some.config.option", "some-value")` before `.getOrCreate()` to set config.

Refer: [Scala Docs](https://spark.apache.org/docs/2.0.0/api/scala/#org.apache.spark.sql.SparkSession), [Python Docs](http://spark.apache.org/docs/2.0.0/api/python/pyspark.sql.html#pyspark.sql.SparkSession)