Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/13592#discussion_r66877689 --- Diff: docs/sql-programming-guide.md --- @@ -604,49 +607,47 @@ JavaRDD<Person> people = sc.textFile("examples/src/main/resources/people.txt").m }); // Apply a schema to an RDD of JavaBeans and register it as a table. -DataFrame schemaPeople = sqlContext.createDataFrame(people, Person.class); +Dataset<Row> schemaPeople = spark.createDataFrame(people, Person.class); schemaPeople.createOrReplaceTempView("people"); // SQL can be run over RDDs that have been registered as tables. -DataFrame teenagers = sqlContext.sql("SELECT name FROM people WHERE age >= 13 AND age <= 19") +Dataset<Row> teenagers = spark.sql("SELECT name FROM people WHERE age >= 13 AND age <= 19") -// The results of SQL queries are DataFrames and support all the normal RDD operations. // The columns of a row in the result can be accessed by ordinal. -List<String> teenagerNames = teenagers.javaRDD().map(new Function<Row, String>() { +List<String> teenagerNames = teenagers.map(new MapFunction<Row, String>() { public String call(Row row) { return "Name: " + row.getString(0); } -}).collect(); +}).collectAsList(); {% endhighlight %} </div> <div data-lang="python" markdown="1"> +<!-- TODO: Is the following still true in Spark 2.0? --> --- End diff -- looks like it's still valid in python
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org