1. 程式人生 > >hive count(*) group by 坑

hive count(*) group by 坑

問題情境 :資料質量監控工具,需要配置sql查詢,得到返回資料值,判斷資料是否在合理範圍之內,公司老司機同志讓我給他加一個爬蟲資料量的監控,判斷爬的資料是否有異常
我的sql是這樣的:select count(1) cnt from datacleanup.ikkyusan_lv0 where yyyymmdd=regexp_replace(cast(date_sub(from_unixtime(unix_timestamp(),’yyyy-MM-dd’),1) as string) ,’-‘,”) group by site

如果這一天沒有資料,你猜返回的是個啥。。。
啥也不返回。。。
類似情況在mysql裡則返回null