码迷,mamicode.com
首页 > 系统相关 > 详细

shell cat 命令的 不靠谱使用,导致hive 表中的小时数据,每隔几天就会缺失一个小时的

时间:2014-10-30 13:40:18      阅读:271      评论:0      收藏:0      [点我收藏+]

标签:style   使用   sp   数据   on   bs   size   new   nbsp   

现象:hive 表中的小时数据,每隔几天就会缺失一个小时的,最后发现时在做数据聚合cat的时候,失败,导致:

修改脚本,做下面的方案,解决了:

##merge 5min data into hour data                                                                                                                        cat $datapath/news_5min_$xhour* >  $localpath/data/channelnews_$hour.txt                                                     #####check                                                                                                                                                     tmppath="${localpath}/data/channelnews_${hour}.txt"                                                                                       i=0                                                                                                                                                                      while (( $i < 10))                                                                                                                                                   do                                                                                                                                                                           m=`du -b $path | awk ‘{print int($1)}‘`                                                                                                                  if [ $m -lt 1024 ];                                                                                                                                                   then                                                                                                                                                                           echo "${path}  is small ,is $m"                                                                                                                                 sleep 5;                                                                                                                                                               else                                                                                                                                                                            break                                                                                                                                                             fi                                                                                                                                                                                 let "i++"                                                                                                                                              done                                                                                                                                                                      echo "i is:$i"       






shell cat 命令的 不靠谱使用,导致hive 表中的小时数据,每隔几天就会缺失一个小时的

标签:style   使用   sp   数据   on   bs   size   new   nbsp   

原文地址:http://my.oschina.net/u/1388024/blog/338796

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!