You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
valpeopleFile= sc.textFile("examples/src/main/resources/people.txt")
peopleFile.first()
caseclassPerson(name: String, age: Int)
valp= peopleFile.map(_.split(",")).map(p =>Person(p(0), p(1).trim.toInt))
p.collect
importorg.apache.spark.sql._valsqlContext=newSQLContext(sc)
importsqlContext._valpeople= sqlContext.createSchemaRDD(p)
people.printSchema
people.registerAsTable("people")
sql("select * from people").collect
sql("select name from people where age > 20").collect
people.where('age>20).select('name).collect
valwiki= sqlContext.parquetFile("wiki_parquet")
wiki.printSchema
wiki.registerAsTable("wiki")
sql("SELECT title FROM wiki WHERE text LIKE '% Scala %'").collect
sql("SELECT title FROM wiki WHERE text LIKE '%Matsuri%'").collect