json数据
{ "id":1 ,"name":"Ella","age":36} { "id":2,"name":"Bob","age":29 } { "id":3 ,"name":"Jack","age":29} { "id":4 ,"name":"Jim","age":28} { "id":4 ,"name":"Jim","age":28} { "id":5 ,"name":"Damon" } { "id":5 ,"name":"Damon" }
命令行:
cd /usr/local/spark bin/spark-shell import org.apache.spark.sql.SparkSession val spark=SparkSession.builder().getOrCreate() import spark.implicits._ val df = spark.read.json("file:///usr/local/spark/employee.json")