Repository: spark
Updated Branches:
  refs/heads/master cd1df6623 -> e0fc9c7e5


[SPARK-11197][SQL] add doc for run SQL on files directly

Author: Wenchen Fan <[email protected]>

Closes #9467 from cloud-fan/doc.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/e0fc9c7e
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/e0fc9c7e
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/e0fc9c7e

Branch: refs/heads/master
Commit: e0fc9c7e59848cb78f8d598898bfca004a3710d8
Parents: cd1df66
Author: Wenchen Fan <[email protected]>
Authored: Wed Nov 4 09:33:30 2015 -0800
Committer: Reynold Xin <[email protected]>
Committed: Wed Nov 4 09:33:30 2015 -0800

----------------------------------------------------------------------
 docs/sql-programming-guide.md | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/e0fc9c7e/docs/sql-programming-guide.md
----------------------------------------------------------------------
diff --git a/docs/sql-programming-guide.md b/docs/sql-programming-guide.md
index 510b359..2fe5c36 100644
--- a/docs/sql-programming-guide.md
+++ b/docs/sql-programming-guide.md
@@ -882,6 +882,44 @@ saveDF(select(df, "name", "age"), "namesAndAges.parquet", 
"parquet")
 </div>
 </div>
 
+### Run SQL on files directly
+
+Instead of using read API to load a file into DataFrame and query it, you can 
also query that
+file directly with SQL.
+
+<div class="codetabs">
+<div data-lang="scala"  markdown="1">
+
+{% highlight scala %}
+val df = sqlContext.sql("SELECT * FROM 
parquet.`examples/src/main/resources/users.parquet`")
+{% endhighlight %}
+
+</div>
+
+<div data-lang="java"  markdown="1">
+
+{% highlight java %}
+DataFrame df = sqlContext.sql("SELECT * FROM 
parquet.`examples/src/main/resources/users.parquet`");
+{% endhighlight %}
+</div>
+
+<div data-lang="python"  markdown="1">
+
+{% highlight python %}
+df = sqlContext.sql("SELECT * FROM 
parquet.`examples/src/main/resources/users.parquet`")
+{% endhighlight %}
+
+</div>
+
+<div data-lang="r"  markdown="1">
+
+{% highlight r %}
+df <- sql(sqlContext, "SELECT * FROM 
parquet.`examples/src/main/resources/users.parquet`")
+{% endhighlight %}
+
+</div>
+</div>
+
 ### Save Modes
 
 Save operations can optionally take a `SaveMode`, that specifies how to handle 
existing data if


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to