Github user dongjoon-hyun commented on a diff in the pull request: https://github.com/apache/spark/pull/13592#discussion_r67202611 --- Diff: docs/sql-programming-guide.md --- @@ -419,35 +419,35 @@ 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`. +The `sql` function on a `SparkSession` enables applications to run SQL queries programmatically and returns the result as a `DataFrame`. <div class="codetabs"> <div data-lang="scala" markdown="1"> {% 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"> {% 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"> {% highlight python %} -from pyspark.sql import SQLContext -sqlContext = SQLContext(sc) -df = sqlContext.sql("SELECT * FROM table") +from pyspark.sql import SparkSession +spark = SparkSession(sc) +df = spark.sql("SELECT * FROM table") {% endhighlight %} </div> <div data-lang="r" markdown="1"> {% highlight r %} -sqlContext <- sparkRSQL.init(sc) -df <- sql(sqlContext, "SELECT * FROM table") +spark <- sparkRSQL.init(sc) +df <- sql(spark, "SELECT * FROM table") --- End diff -- Here, too. Remove `spark <- sparkRSQL.init(sc)` and use ``` df <- sql("SELECT * FROM table") ```
--- 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