You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/12/06 14:47:38 UTC

[GitHub] [spark] srowen commented on a change in pull request #34821: [WIP][SPARK-37558][DOC] Improve spark sql cli document

srowen commented on a change in pull request #34821:
URL: https://github.com/apache/spark/pull/34821#discussion_r763072685



##########
File path: docs/sql-distributed-sql-engine.md
##########
@@ -90,12 +90,8 @@ See more details in [[SPARK-21067]](https://issues.apache.org/jira/browse/SPARK-
 
 ## Running the Spark SQL CLI
 
-The Spark SQL CLI is a convenient tool to run the Hive metastore service in local mode and execute
-queries input from the command line. Note that the Spark SQL CLI cannot talk to the Thrift JDBC server.
+To use the Spark SQL command line interface (CLI) from the shell:
 
-To start the Spark SQL CLI, run the following in the Spark directory:
-
-    ./bin/spark-sql
-
-Configuration of Hive is done by placing your `hive-site.xml`, `core-site.xml` and `hdfs-site.xml` files in `conf/`.
-You may run `./bin/spark-sql --help` for a complete list of all available options.
+    ./bin/hive
+    
+Details please refer to [Spark SQL CLI](sql-distributed-sql-engine-spark-sql-cli.html)

Review comment:
       "For details, please refer..."

##########
File path: docs/sql-distributed-sql-engine-spark-sql-cli.md
##########
@@ -0,0 +1,169 @@
+---
+layout: global
+title: Spark SQL CLI
+displayTitle: Spark SQL CLI
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+* Table of contents
+{:toc}
+
+
+The Spark SQL CLI is a convenient tool to run the Hive metastore service in local mode and execute
+queries input from the command line. Note that the Spark SQL CLI cannot talk to the Thrift JDBC server.
+
+To start the Spark SQL CLI, run the following in the Spark directory:
+
+    ./bin/spark-sql
+
+Configuration of Hive is done by placing your `hive-site.xml`, `core-site.xml` and `hdfs-site.xml` files in `conf/`.
+
+## Spark SQL Command Line Options
+
+You may run `./bin/spark-sql --help` for a complete list of all available options.
+
+    CLI options:
+     -d,--define <key=value>          Variable substitution to apply to Hive
+                                      commands. e.g. -d A=B or --define A=B
+        --database <databasename>     Specify the database to use
+     -e <quoted-query-string>         SQL from command line
+     -f <filename>                    SQL from files
+     -H,--help                        Print help information
+        --hiveconf <property=value>   Use value for given property
+        --hivevar <key=value>         Variable substitution to apply to Hive
+                                      commands. e.g. --hivevar A=B
+     -i <filename>                    Initialization SQL file
+     -S,--silent                      Silent mode in interactive shell
+     -v,--verbose                     Verbose mode (echo executed SQL to the
+                                      console)
+
+## The hiverc File
+
+The Spark SQL CLI when invoked without the `-i` option will attempt to load `$HIVE_HOME/bin/.hiverc` and `$HOME/.hiverc` as initialization files.
+
+## Spark SQL CLI Interactive Shell Commands
+
+When `$SPARK__HOME/bin/spark-sql` is run without either the `-e` or `-f` option, it enters interactive shell mode.
+Use `;` (semicolon) to terminate commands, but user can escape `;` by `\\;`. Comments in scripts can be specified using the `--` prefix.
+
+<table class="table">
+<tr><th>Command</th><th>Description</th></tr>
+<tr>
+  <td><code>quit</code> <code>exit</code></td>
+  <td>Use <code>quit</code> or <code>exit</code> to leave the interactive shell.</td>
+</tr>
+<tr>
+  <td><code>!&lt;command&gt;</code></td>
+  <td>Executes a shell command from the Spark SQL CLI shell.</td>
+</tr>
+<tr>
+  <td><code>dfs &lt;dfs command&gt;</code></td>
+  <td>Executes a dfs command from the Hive shell.</td>
+</tr>
+<tr>
+  <td><code>&lt;query string&gt;</code></td>
+  <td>Executes a Spark SQL query and prints results to standard output.</td>
+</tr>
+<tr>
+  <td><code>source &lt;filepath&gt;</code></td>
+  <td>Executes a script file inside the CLI.</td>
+</tr>
+</table>
+
+## Supported comment type

Review comment:
       types

##########
File path: docs/sql-distributed-sql-engine.md
##########
@@ -90,12 +90,8 @@ See more details in [[SPARK-21067]](https://issues.apache.org/jira/browse/SPARK-
 
 ## Running the Spark SQL CLI
 
-The Spark SQL CLI is a convenient tool to run the Hive metastore service in local mode and execute
-queries input from the command line. Note that the Spark SQL CLI cannot talk to the Thrift JDBC server.
+To use the Spark SQL command line interface (CLI) from the shell:
 
-To start the Spark SQL CLI, run the following in the Spark directory:
-
-    ./bin/spark-sql
-
-Configuration of Hive is done by placing your `hive-site.xml`, `core-site.xml` and `hdfs-site.xml` files in `conf/`.
-You may run `./bin/spark-sql --help` for a complete list of all available options.
+    ./bin/hive

Review comment:
       Why isn't this spark-sql?

##########
File path: docs/sql-distributed-sql-engine-spark-sql-cli.md
##########
@@ -0,0 +1,169 @@
+---
+layout: global
+title: Spark SQL CLI
+displayTitle: Spark SQL CLI
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+* Table of contents
+{:toc}
+
+
+The Spark SQL CLI is a convenient tool to run the Hive metastore service in local mode and execute
+queries input from the command line. Note that the Spark SQL CLI cannot talk to the Thrift JDBC server.
+
+To start the Spark SQL CLI, run the following in the Spark directory:
+
+    ./bin/spark-sql
+
+Configuration of Hive is done by placing your `hive-site.xml`, `core-site.xml` and `hdfs-site.xml` files in `conf/`.
+
+## Spark SQL Command Line Options
+
+You may run `./bin/spark-sql --help` for a complete list of all available options.
+
+    CLI options:
+     -d,--define <key=value>          Variable substitution to apply to Hive
+                                      commands. e.g. -d A=B or --define A=B
+        --database <databasename>     Specify the database to use
+     -e <quoted-query-string>         SQL from command line
+     -f <filename>                    SQL from files
+     -H,--help                        Print help information
+        --hiveconf <property=value>   Use value for given property
+        --hivevar <key=value>         Variable substitution to apply to Hive
+                                      commands. e.g. --hivevar A=B
+     -i <filename>                    Initialization SQL file
+     -S,--silent                      Silent mode in interactive shell
+     -v,--verbose                     Verbose mode (echo executed SQL to the
+                                      console)
+
+## The hiverc File
+
+The Spark SQL CLI when invoked without the `-i` option will attempt to load `$HIVE_HOME/bin/.hiverc` and `$HOME/.hiverc` as initialization files.
+
+## Spark SQL CLI Interactive Shell Commands
+
+When `$SPARK__HOME/bin/spark-sql` is run without either the `-e` or `-f` option, it enters interactive shell mode.
+Use `;` (semicolon) to terminate commands, but user can escape `;` by `\\;`. Comments in scripts can be specified using the `--` prefix.
+
+<table class="table">
+<tr><th>Command</th><th>Description</th></tr>
+<tr>
+  <td><code>quit</code> <code>exit</code></td>
+  <td>Use <code>quit</code> or <code>exit</code> to leave the interactive shell.</td>
+</tr>
+<tr>
+  <td><code>!&lt;command&gt;</code></td>
+  <td>Executes a shell command from the Spark SQL CLI shell.</td>
+</tr>
+<tr>
+  <td><code>dfs &lt;dfs command&gt;</code></td>
+  <td>Executes a dfs command from the Hive shell.</td>
+</tr>
+<tr>
+  <td><code>&lt;query string&gt;</code></td>
+  <td>Executes a Spark SQL query and prints results to standard output.</td>
+</tr>
+<tr>
+  <td><code>source &lt;filepath&gt;</code></td>
+  <td>Executes a script file inside the CLI.</td>
+</tr>
+</table>
+
+## Supported comment type
+
+<table class="table">
+<tr><th>Comment</th><th>Example</th></tr>
+<tr>
+  <td>simple comment</td>
+  <td>
+  <code>
+      -- This is a simple comment.
+      <br>
+      SELECT 1;
+  </code>
+  </td>
+</tr>
+<tr>
+  <td>bracketed comment</td>
+  <td>
+    <code>
+        /* This is a bracketed comment. */
+        <br>
+        SELECT 1;
+    </code>
+  </td>
+</tr>
+<tr>
+  <td>nested bracketed comment</td>
+  <td>
+    <code>
+        /*  This is a /* nested bracketed comment*/ .*/
+        <br>
+        SELECT 1;
+    </code>
+  </td>
+</tr>
+</table>
+
+## Examples
+
+See Variable Substitution for examples of using the hiveconf option.

Review comment:
       Is this meant to be a link?

##########
File path: docs/sql-distributed-sql-engine-spark-sql-cli.md
##########
@@ -0,0 +1,169 @@
+---
+layout: global
+title: Spark SQL CLI
+displayTitle: Spark SQL CLI
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+* Table of contents
+{:toc}
+
+
+The Spark SQL CLI is a convenient tool to run the Hive metastore service in local mode and execute
+queries input from the command line. Note that the Spark SQL CLI cannot talk to the Thrift JDBC server.
+
+To start the Spark SQL CLI, run the following in the Spark directory:
+
+    ./bin/spark-sql
+
+Configuration of Hive is done by placing your `hive-site.xml`, `core-site.xml` and `hdfs-site.xml` files in `conf/`.
+
+## Spark SQL Command Line Options
+
+You may run `./bin/spark-sql --help` for a complete list of all available options.
+
+    CLI options:
+     -d,--define <key=value>          Variable substitution to apply to Hive
+                                      commands. e.g. -d A=B or --define A=B
+        --database <databasename>     Specify the database to use
+     -e <quoted-query-string>         SQL from command line
+     -f <filename>                    SQL from files
+     -H,--help                        Print help information
+        --hiveconf <property=value>   Use value for given property
+        --hivevar <key=value>         Variable substitution to apply to Hive
+                                      commands. e.g. --hivevar A=B
+     -i <filename>                    Initialization SQL file
+     -S,--silent                      Silent mode in interactive shell
+     -v,--verbose                     Verbose mode (echo executed SQL to the
+                                      console)
+
+## The hiverc File
+
+The Spark SQL CLI when invoked without the `-i` option will attempt to load `$HIVE_HOME/bin/.hiverc` and `$HOME/.hiverc` as initialization files.
+
+## Spark SQL CLI Interactive Shell Commands
+
+When `$SPARK__HOME/bin/spark-sql` is run without either the `-e` or `-f` option, it enters interactive shell mode.
+Use `;` (semicolon) to terminate commands, but user can escape `;` by `\\;`. Comments in scripts can be specified using the `--` prefix.
+
+<table class="table">
+<tr><th>Command</th><th>Description</th></tr>
+<tr>
+  <td><code>quit</code> <code>exit</code></td>
+  <td>Use <code>quit</code> or <code>exit</code> to leave the interactive shell.</td>
+</tr>
+<tr>
+  <td><code>!&lt;command&gt;</code></td>
+  <td>Executes a shell command from the Spark SQL CLI shell.</td>
+</tr>
+<tr>
+  <td><code>dfs &lt;dfs command&gt;</code></td>
+  <td>Executes a dfs command from the Hive shell.</td>

Review comment:
       We should say what dfs means




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org