diff options
author | Dongjoon Hyun <dongjoon@apache.org> | 2016-03-22 23:07:49 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2016-03-22 23:07:49 -0700 |
commit | 1a22cf1e9b6447005c9a329856d734d80a496a06 (patch) | |
tree | 00ee53b6a162d4198d11c4f4ff55dfcedfebe403 /sql/README.md | |
parent | 75dc29620e8bf22aa56a55c0f2bc1b85800e84b1 (diff) | |
download | spark-1a22cf1e9b6447005c9a329856d734d80a496a06.tar.gz spark-1a22cf1e9b6447005c9a329856d734d80a496a06.tar.bz2 spark-1a22cf1e9b6447005c9a329856d734d80a496a06.zip |
[MINOR][SQL][DOCS] Update `sql/README.md` and remove some unused imports in `sql` module.
## What changes were proposed in this pull request?
This PR updates `sql/README.md` according to the latest console output and removes some unused imports in `sql` module. This is done by manually, so there is no guarantee to remove all unused imports.
## How was this patch tested?
Manual.
Author: Dongjoon Hyun <dongjoon@apache.org>
Closes #11907 from dongjoon-hyun/update_sql_module.
Diffstat (limited to 'sql/README.md')
-rw-r--r-- | sql/README.md | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/README.md b/sql/README.md index 9ea271d33d..b0903980a5 100644 --- a/sql/README.md +++ b/sql/README.md @@ -47,7 +47,7 @@ An interactive scala console can be invoked by running `build/sbt hive/console`. From here you can execute queries with HiveQl and manipulate DataFrame by using DSL. ```scala -catalyst$ build/sbt hive/console +$ build/sbt hive/console [info] Starting scala interpreter... import org.apache.spark.sql.catalyst.analysis._ @@ -61,22 +61,23 @@ import org.apache.spark.sql.execution import org.apache.spark.sql.functions._ import org.apache.spark.sql.hive._ import org.apache.spark.sql.hive.test.TestHive._ +import org.apache.spark.sql.hive.test.TestHive.implicits._ import org.apache.spark.sql.types._ Type in expressions to have them evaluated. Type :help for more information. scala> val query = sql("SELECT * FROM (SELECT * FROM src) a") -query: org.apache.spark.sql.DataFrame = org.apache.spark.sql.DataFrame@74448eed +query: org.apache.spark.sql.DataFrame = [key: int, value: string] ``` Query results are `DataFrames` and can be operated as such. ``` scala> query.collect() -res2: Array[org.apache.spark.sql.Row] = Array([238,val_238], [86,val_86], [311,val_311], [27,val_27]... +res0: Array[org.apache.spark.sql.Row] = Array([238,val_238], [86,val_86], [311,val_311], [27,val_27]... ``` You can also build further queries on top of these `DataFrames` using the query DSL. ``` scala> query.where(query("key") > 30).select(avg(query("key"))).collect() -res3: Array[org.apache.spark.sql.Row] = Array([274.79025423728814]) +res1: Array[org.apache.spark.sql.Row] = Array([274.79025423728814]) ``` |