...
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:
|
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="af8cdd1c79b6637f-a627479d-4c144265-97e79cbb-5788bb2a92a82bdf857be7c7"><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="1e11b289820a2418-65bfcdab-40cf4166-bd3c83f0-cb2c438e5a0fffeeaa0f0063"><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="7e5ede89f840571c-db8fd10a-43714a00-935696da-afde803d86d9b8cdf9b60b9e"><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="d6db6224ff34a3d1-e4a8c25b-4f9e4768-87218824-65afac9bf8e8d8850aec27fd"><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. |
...