Created
November 22, 2014 02:25
-
-
Save krishnabhargav/17fb00e289741cbc9c7b to your computer and use it in GitHub Desktop.
Spark SQL example ... beautiful...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val sqlContext = new org.apache.spark.sql.SQLContext(sc); //sc is SparkContext | |
import sqlContext._ | |
case class Person(name: String, age: Int) | |
val randomPeople = sc.parallelize(1 to 1000).map(i => Person("Yu_"+i,i)) | |
randomPeople.registerAsTable("people") | |
val aged30 = sql("select * from people where age = 30") | |
aged30.foreach(println(_)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
IPYTHON_OPTS="notebook --pylab inline" ./pyspark to launch spark supported python notebook