Last active
August 29, 2015 14:21
-
-
Save lildata/61d33a0370149e2d2c63 to your computer and use it in GitHub Desktop.
Playing with Spark Dataframe, see https://spark.apache.org/docs/latest/api/scala/#org.apache.spark.sql.DataFrame
This file contains 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
scala> val sqlc = new org.apache.spark.sql.SQLContext(sc) | |
scala> import sqlc.implicits._ //to implicitly convert an RDD to a DataFrame | |
scala> val df1 = sqlc.load("/home/....json","json") | |
scala> df1.printSchema | |
scala> df1.select("name").show | |
scala> df1.select("name", df1("age") + 1).show | |
scala> df1.filter(df1("age") > 10).show | |
scala> df1.groupBy("age").count().show | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment