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



##########
File path: docs/sql-distributed-sql-engine-spark-sql-cli.md
##########
@@ -0,0 +1,185 @@
+---
+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 SQL
+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

Review comment:
       > what's the difference between --hiveconf, --hivevar and --define?
   
   The hiveconf namespace and --hiveconf should be used to set Hive 
configuration values.
   The hivevar namespace and --hivevar should be used to define user variables.
   Setting user variables under the hiveconf namespace probably won't break 
anything, but isn't recommended.
   
   The --hivevar variables are accessed using ${var-name}, while the --hiveconf 
are accessed ${hiveconf:var-name} inside hive.
   
   




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to