-
不能select非group的字段
-
当字段值为string的时候,可以用is not null来判断为不为空;当字段值是array的时候,要用size()来判断是不是为空[],用null判断的是全空,连[]也没有的情况
-
在hive中支持 in 语法的 ,只是在 in 中不能接一个子查询,所以要in子查询的话,最好写成关联表形式
-
MD5函数:select md5(orderid) from es.qhlo_borrower_contactinfo where orderid = '6859238';
说明MD5是个函数,不能写在最外围,必须写在select后面,而且MD5(*)是错的,里面只能是具体的string或者binary
-
注意集合一列数据的时候用collect_set加group , 集合多列数据的时候,用array(map()),例如:
Select
m.orderid as clientid,
array(map(
'clientid',m.orderid,
-- 'channel_source','1',
扫描二维码关注公众号,回复: 4641131 查看本文章'both_ends','1',
-- 'customer_channel','1',
'system_source','84',
'business_channel','70',
'source_create_date',m.appSubmissionTime,
'ct',a.createtime,
'lt',a.updatetime
)) as t_pd_will_info
from
es.qhlo_apply_applyinfo m
LEFT JOIN
es.qhlo a on a.orderid=m.orderid
Hive 的collect_set使用详解
-
hive命令行操作:
su - dev
hive
就进入hive了
set hive.cli.print.header=true;
在hive命令行执行的时候,一定记得加limit xx;否则数据量太大
cast(xx as bigint) 表示不以科学数字展示
use 数据库名;
show tables ‘*icp*’;模糊搜索表
desc table 展示表DDL
nohup hive -hiveconf date='init' -hivevar where='' -f 50confirm.sql > 50confirm.log &
ds='${hiveconf:date}'
hivesql写的时候要注意的点(后续还会补充)
猜你喜欢
转载自blog.csdn.net/bd2569/article/details/85244166
今日推荐
周排行