This is my code:
val array = Array("Tom,9", "Amy,10")
val peopleRDD = sc.parallelize(array)
.map(line => {
People(line.split(",")(0), line.split(",")(1).toInt)
})
import ssb.implicits._
val df = peopleRDD.toDF()
df.createOrReplaceTempView("people")
val ipMap = new mutable.HashMap[String, String]()
ssb.sql("""
|select name from people
|""".stripMargin)
.foreach(x => {
ipMap.put("aaa", x.apply(0).toString)
})
for ((key, value) <- ipMap) {
println("key is" + key + " ,value is" + value)
}
Why is the map empty and no output? How can I assign values correctly?