THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Hive Command line Options
To get help run hive -H
Usage (as it is in Hive 0.9.0):
Code Block |
---|
Usageusage: hive [-hiveconf x=y]* [<-i filename>]* [<-f filename>|<-e query-string>] [-S] -i <filename>-d,--define <key=value> Variable subsitution to apply to hive Initialization Sql from file (executed automatically and silently before any other commands) -e 'quoted query string' Sql. e.g. -d A=B or --define A=B -e <quoted-query-string> SQL from command line -f <filename> SqlSQL from file -Sfiles -H,--help Print help information -h <hostname> connecting to Hive Server on remote Silent mode in interactive shell where only data is emitted -vhost --hiveconf <property=value> Use value for given property --hivevar <key=value> Variable subsitution to apply to hive Verbose mode (echo executed SQL to the console) commands. e.g. --hivevar A=B -i <filename> Initialization SQL file -p <port> connect connecting to Hive Server on port number -S,--silent -hiveconf x=y Use this to setSilent hive/hadoopmode configurationin variables.interactive shell -v,--verbose -e and -f cannot be specified together. In the absence of these options,Verbose interactivemode shell(echo isexecuted started.SQL to the However, -i can be used with any other options. Multiple instances of -i can be used to execute multiple init scripts. To see this usage help, run hive -h console) |
Info | ||
---|---|---|
| ||
As of Hive 0.10.0 there is one additional command line option:
|
- Example of running Query from 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
Hive interactive Shell Command
When $HIVE_HOME/bin/hive is run without either -e/-f option it enters interactive shell mode.
...