...
No Format |
---|
usage: hive -d,--define <key=value> Variable substitution to apply to hive commands. e.g. -d A=B or --define A=B -e <quoted-query-string> SQL from command line -f <filename> SQL from files -H,--help Print help information -h <hostname> Connecting to Hive Server on remote host --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 -p <port> Connecting to Hive Server on port number -S,--silent Silent mode in interactive shell -v,--verbose Verbose mode (echo executed SQL to the console) |
See Variable Substitution for examples of using the hiveconf
option.
Info | ||
---|---|---|
| ||
As of Hive 0.10.0 there is one additional command line option:
|
Another command line option, --service
, can be used for the Hive Thrift Server or HiveServer2. See Hive Server and Setting Up HiveServer2.
Examples
...
- Example of running a query from the command line
Code Block $HIVE_HOME/bin/hive -e 'select a.col from tab1 a'
- Example of setting Hive configuration variables
Code Block $HIVE_HOME/bin/hive -e 'select a.col from tab1 a' -hiveconf hive.exec.scratchdir=/home/my/hive_scratch -hiveconf mapred.reduce.tasks=32
- Example of dumping data out from a query into a file using silent mode
Code Block $HIVE_HOME/bin/hive -S -e 'select a.col from tab1 a' > a.txt
- Example of running a script non-interactively
Code Block $HIVE_HOME/bin/hive -f /home/my/hive-script.sql
- Example of running an initialization script before entering interactive mode
Code Block $HIVE_HOME/bin/hive -i /home/my/hive-init.sql
...
Command | Description | ||
---|---|---|---|
quit | Use quit or exit to leave the interactive shell. | ||
reset | Resets the configuration to the default values (as of Hive 0.10: see HIVE-3202). | ||
set <key>=<value> | Sets the value of a particular configuration variable (key). | ||
set | Prints a list of configuration variables that are overridden by the user or Hive. | ||
set -v | Prints all Hadoop and Hive configuration variables. | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0ddfd47cf2bdd454-2ff33b06-4c084162-a3779ae5-9ed83b30a264f54e417eaaff"><ac:plain-text-body><![CDATA[ | add FILE[S] <filepath> <filepath>* | Adds one or more files, jars, or archives to the list of resources in the distributed cache. | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7b0224ec4ce42180-6da9e78a-4df34125-9763bc95-405e85fe52ed50a854f5729d"><ac:plain-text-body><![CDATA[ | list FILE[S] | Lists the resources already added to the distributed cache. | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="4a98f0386f766159-cd0552f9-41c94cb2-b890a7c5-a372e1cc5421518268575eaa"><ac:plain-text-body><![CDATA[ | list FILE[S] <filepath>* | Checks whether the given resources are already added to the distributed cache or not. | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7724b92bb88ef18e-55b8a26b-46254529-ae1ba5de-10efaed0cb948bf2af68c990"><ac:plain-text-body><![CDATA[ | delete FILE[S] <filepath>* | Removes the resource(s) from the distributed cache. | ]]></ac:plain-text-body></ac:structured-macro> |
! <command> | Executes a shell command from the Hive shell. | ||
dfs <dfs command> | Executes a dfs command from the Hive shell. | ||
<query string> | Executes a Hive query and prints results to standard output. | ||
source FILE <filepath> | Executes a script file inside the CLI. |
...