There are two ways to create context in Spark SQL:


scala> import org.apache.spark.sql._
scala> var sqlContext = new SQLContext(sc)


scala> import org.apache.spark.sql.hive._
scala> val hc = new HiveContext(sc)

Though most of the code examples you see use SqlContext, you should always use HiveContext. HiveContext is a superset of SqlContext, so it can do what SQLContext can do and much more. You do not have to connect to Hive to use HiveContext.