在命令行,使用thrift服务执行
insert overwrite table ads_temp
select sum(if(overage=1 and array_contains(split(contract_type,'\\|'),50),1,0)) as overage1_contract1_cnts
from ykchr.dwd_emp_info2 where dt ='2020-05-20' group by p1,p2,p3,p4,p5,p6
没有问题
但是在shell脚本中,'\\|'将会被解析为'\|'提交,从而导致错误
因此在shell脚本中的这种转义,需要变为'\\\|'
最好的避免这种坑的方式,是不要使用带有正则意义的分隔符