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

你可能感兴趣的:(hive不合规数据导出到csv文件)