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

#!/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
    原文作者:Mr_Alfred
    原文地址: https://www.jianshu.com/p/7dc2bc823fcc
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞