Hive 之 -e -f -i

zhuanzi: http://blog.csdn.net/u010220089/article/details/49231705


1、bin/hive -help

[html]  view plain  copy
  1. bin/hive -help  
  2. 15/10/18 06:34:46 WARN conf.HiveConf: DEPRECATED: hive.metastore.ds.retry.* no longer has any effect.  Use hive.hmshandler.retry.* instead  
  3. usage: hive  
  4.  -d,--define <keykey=value>          Variable subsitution to apply to hive  
  5.                                   commands. e.g. -d A=B or --define A=B  
  6.     --database <databasename>     Specify the database to use  
  7.  -e <quoted-query-string>         SQL from command line  
  8.  -f <filename>                    SQL from files  
  9.  -H,--help                        Print help information  
  10.  -h <hostname>                    connecting to Hive Server on remote host  
  11.     --hiveconf <propertyproperty=value>   Use value for given property  
  12.     --hivevar <keykey=value>         Variable subsitution to apply to hive  
  13.                                   commands. e.g. --hivevar A=B  
  14.  -i <filename>                    Initialization SQL file  
  15.  -p <port>                        connecting to Hive Server on port number  
  16.  -S,--silent                      Silent mode in interactive shell  
  17.  -v,--verbose                     Verbose mode (echo executed SQL to the  


2、hive -e 用法

[html]  view plain  copy
  1. [root@cloud1 hive-0.13.1]# bin/hive -e 'select *  from default.student'  
  2. 15/10/18 06:55:27 WARN conf.HiveConf: DEPRECATED: hive.metastore.ds.retry.* no longer has any effect.  Use hive.hmshandler.retry.* instead  
  3.   
  4.   
  5. Logging initialized using configuration in jar:file:/opt/hive-0.13.1/lib/hive-common-0.13.1.jar!/hive-log4j.properties  
  6. OK  
  7. 1   xiaoming  
  8. 2   zhangsan  
  9. 3   lisi  
  10. Time taken: 21.298 seconds, Fetched: 3 row(s)  

hkl曰:我们什么情景下使用这个呢?


这种用法我们就不用进入到hive模式直接就可以来做。我们在脚本里执行的时候也可以用这个。


3、hive -f 用法

[html]  view plain  copy
  1. [root@cloud1 hive-0.13.1]# touch hfile.sql  
  2. [root@cloud1 hive-0.13.1]# vi hfile.sql  
  3. select * from default.student ;   
  4. bin/hive -f /opt/hive-0.13.1/hfile.sql  
  5. [root@cloud1 hive-0.13.1]# bin/hive -f /opt/hive-0.13.1/hfile.sql  
  6. 15/10/18 07:00:12 WARN conf.HiveConf: DEPRECATED: hive.metastore.ds.retry.* no longer has any effect.  Use hive.hmshandler.retry.* instead  
  7.   
  8.   
  9. Logging initialized using configuration in jar:file:/opt/hive-0.13.1/lib/hive-common-0.13.1.jar!/hive-log4j.properties  
  10. OK  
  11. 1   xiaoming  
  12. 2   zhangsan  
  13. 3   lisi  
  14. Time taken: 13.048 seconds, Fetched: 3 row(s)  
  15.   
  16. 或者: bin/hive -f hdfs://192.168.80.20:8020/user/hive/hfile.sql  


4、hive -i 用法:(这里占时还没有例子)

* bin/hive -i xx
-i <filename>                    Initialization SQL file
eg:
add jar xxx.jar
add file xxx
create temporary function my_lower as ....
bin/hive -i hive-init.sql


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值