...
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
See Variable Substitution for examples of using the hiveconf
option.
- 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="b2e2818866661044-b29bfd36-42a44f3a-a0628cd2-87b0e8a2e5a4823590d27113"><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="c6941806b9480345-86550812-4a1b4b6b-9db7a2b2-7ef1086a8fa2da246c863b4e"><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="7f99101c91ba61b4-48e726f8-48ee4abe-9eeeb7f8-91df821117213e3ceea2db6c"><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="04b89478674be467-061cdf75-46c34863-b59faa54-0f4995985169cff767eed2b9"><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. |
...