美文网首页
hive不合规数据导出到csv文件

hive不合规数据导出到csv文件

作者: 夜空最亮的9星 | 来源:发表于2018-08-07 17:55 被阅读19次
#!/bin/bash

arrayList=("ods_12_newepay_payment" 
"ods_13_newepay_return" 
"ods_15_pos_detail" 
"ods_16_pos_tender" 
"ods_31_tmall_head"
"ods_32_tmall_detail"
"ods_33_tmall_o2o_head"
"ods_34_tmall_o2o_detail"
)

length=${#arrayList[@]}

for ((i=0; i < length; i ++))
do
        cmd=${arrayList[i]}
        # echo "cmd == $cmd"  >> /root/tmp/hive_result/${cmd}_result.txt
        hive -e "select * from crm_ods.$cmd where ( data_invalid_type <> 'NONE' or  data_invalid_type is null) " | sed 's/[\t]/,/g' >> /root/tmp/hive_result/${cmd}_result.csv

done

相关文章

网友评论

      本文标题:hive不合规数据导出到csv文件

      本文链接:https://www.haomeiwen.com/subject/yuiavftx.html