Error while using import org.apache.spark.sql.SparkSession in Intellij


#1

I am seeing SparkSession in RED while using the import org.apache.spark.sql.SparkSession in Intellij

My sbt file look like

name := “New_Project”

version := “0.1”

scalaVersion := “2.11.0”

libraryDependencies += “org.apache.spark” %% “spark-core” % “2.3.0”
libraryDependencies += “org.apache.spark” %% “spark-sql” % “2.3.0”

My Application:

object SimpleApp {
def main(args: Array[String]) {
val logFile = “/user/mraheemabdul/README.md”
val spark = SparkSession.builder.appName(“Simple Application”).getOrCreate()
val logData = spark.read.textFile(logFile).cache()
val numAs = logData.filter(line => line.contains(“a”)).count()
val numBs = logData.filter(line => line.contains(“b”)).count()
println(s"Lines with a: $numAs, Lines with b: $numBs")
spark.stop()
}
}