...
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="3edd8de6540afd21-54706bb9-44cf4241-98a7b052-4714b7a1c7193ab3a4d2a9bb"><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="729e426589f0919c-99082c15-4f0c42c5-97e5966a-bfe28dee10a927dffd142a9c"><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="e7f6bc9fd6781037-26418d81-46a14e2e-a73a9e9a-03ca59080b714467872a8878"><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="d8941541a006ea47-88f8cb40-40d746e3-9692b0ed-2da7eba6914383ff823b4543"><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. |
...