I am trying to run the simple following code using spark within Eclipse:
import org.apache.spark.sql.SQLContext
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
object jsonreader {
def main(args: Array[String]): Unit = {
println("Hello, world!")
val conf = new SparkConf()
.setAppName("TestJsonReader")
.setMaster("local")
.set("spark.driver.memory", "3g")
val sc = new SparkContext(conf)
val sqlContext = new SQLContext(sc)
val df = sqlContext.read.format("json").load("text.json")
df.printSchema()
df.show
}
}
However, I get the following errors:
16/08/18 18:05:28 ERROR SparkContext: Error initializing SparkContext.
java.lang.IllegalArgumentException: System memory 259522560 must be at least 471859200. Please increase heap size using the --driver-memory option or spark.driver.memory in Spark configuration.
I followed different tutorials like this one: How to set Apache Spark Executor memory. Most of time either I use --driver-memory
option (not possible with Eclipse) or by modifiying the spark configuration but there is no corresponding file.
Does anyone have any idea about how to solve this issue within Eclipse environment?