hive函数实例

本文介绍了Hive中的一些重要函数,包括and和or的优先级、cast类型转换、if和case when表达式、get_json_object及parse_url函数用于解析URL、collect_set和collect_list用于收集集合、partition操作、rank系列函数进行排名计算,以及java_method、reflect、explode、rlike和regexp_replace等字符串处理函数,提供了丰富的实例和解析。
摘要由CSDN通过智能技术生成

1.and和or的优先级
and优先级大于or

root@ubuntu:~# cat windfunc 
1001    100.0   ABC
1001    150.0   BCD
1001    200.0   CDE
1001    150.0   DEF
1002    200.0   ABC
1002    200.0   ABC
1002    100.0   BCD
1002    300.0   CDE
1002    50.0    DEF
1002    400.0   EFG
1003    100.0   ABC
1003    50.0    BCD
1004    60.0    ABC
hive> create  table windfunc(id string,money float,type string) row format delimited fields terimnated by '\t' lines terminated by '\n' stored as textfile;
hive> load data local inpath '/root/windfunc' into table windfunc;
Copying data from file:/root/windfunc
Copying file: file:/root/windfunc
Loading data to table default.windfunc
[Warning] could not update stats.
OK
Time taken: 2.7 seconds
hive> select * from windfunc;
OK
1001    100.0   ABC
1001    150.0   BCD
1001    200.0   CDE
1001    150.0   DEF
1002    200.0   ABC
1002    200.0   ABC
1002    100.0   BCD
1002    300.0   CDE
1002    50.0    DEF
1002    400.0   EFG
1003    100.0   ABC
1003    50.0    BCD
1004    60.0    ABC
Time taken: 0.272 seconds, Fetched: 13 row(s)
hive> select * from windfunc where id = '1001' or id = '1002' and money = '100.0';

OK
1001    100.0   ABC
1001    150.0   BCD
1001    200.0   CDE
1001    150.0   DEF
1002    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值