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

本文介绍了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等字符串处理函数,提供了丰富的实例和解析。
最低0.47元/天 解锁文章
630

被折叠的 条评论
为什么被折叠?



