In the file main.scala
,
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.SparkConf
import java.sql._
object ConnTest extends App {
val conf = new SparkConf()
val sc = new SparkContext(conf.setAppName("Test").setMaster("local[*]"))
val sqlContext = new org.apache.spark.sql.SQLContext(sc)
sc.stop()
}
However, the sbt run
got the following error.
[info] Compiling 1 Scala source to C:\Users\user1\IdeaProjects\sqlServer\target\scala-2.11\classes... [error] C:\Users\user1\IdeaProjects\sqlServer\src\main\scala\main.scala:9: type SQLContext is not a member of package org.apache.spark.sql [error] val sqlContext = new org.apache.spark.sql.SQLContext(sc) [error] ^ [error] one error found [error] (compile:compileIncremental) Compilation failed [error] Total time: 1 s, completed May 11, 2017 6:11:47 PM