Github user felixcheung commented on a diff in the pull request: https://github.com/apache/spark/pull/13592#discussion_r67749954 --- Diff: docs/sql-programming-guide.md --- @@ -419,35 +423,39 @@ In addition to simple column references and expressions, DataFrames also have a ## Running SQL Queries Programmatically -The `sql` function on a `SQLContext` enables applications to run SQL queries programmatically and returns the result as a `DataFrame`. - <div class="codetabs"> <div data-lang="scala" markdown="1"> +The `sql` function on a `SparkSession` enables applications to run SQL queries programmatically and returns the result as a `DataFrame`. + {% highlight scala %} -val sqlContext = ... // An existing SQLContext -val df = sqlContext.sql("SELECT * FROM table") +val spark = ... // An existing SparkSession +val df = spark.sql("SELECT * FROM table") {% endhighlight %} </div> <div data-lang="java" markdown="1"> +The `sql` function on a `SparkSession` enables applications to run SQL queries programmatically and returns the result as a `Dataset<Row>`. + {% highlight java %} -SQLContext sqlContext = ... // An existing SQLContext -DataFrame df = sqlContext.sql("SELECT * FROM table") +SparkSession spark = ... // An existing SparkSession +Dataset<Row> df = spark.sql("SELECT * FROM table") {% endhighlight %} </div> <div data-lang="python" markdown="1"> +The `sql` function on a `SparkSession` enables applications to run SQL queries programmatically and returns the result as a `DataFrame`. + {% highlight python %} -from pyspark.sql import SQLContext -sqlContext = SQLContext(sc) -df = sqlContext.sql("SELECT * FROM table") +# spark is an existing SparkSession +df = spark.sql("SELECT * FROM table") {% endhighlight %} </div> <div data-lang="r" markdown="1"> +The `sql` function enables applications to run SQL queries programmatically and returns the result as a `DataFrame`. --- End diff -- also, in SparkR, the class is called "SparkDataFrame"
--- 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