關於hive sql空指針異常 HIVE_ERORR:Error while compiling statement: FAILED: SemanticException java.lang.NullPointerException


注意檢查是否指定了分區,如果使用datediff篩選一段時間內的數據,容易踩坑

where datediff(from_unixtime(unix_timestamp(${sdate},'yyyyMMdd'),'yyyy-MM-dd'),from_unixtime(unix_timestamp(sdt,'yyyyMMdd'),'yyyy-MM-dd'))>=0 -- 日期格式:yyyyMMdd
and datediff(from_unixtime(unix_timestamp(${sdate},'yyyyMMdd'),'yyyy-MM-dd'),from_unixtime(unix_timestamp(sdt,'yyyyMMdd'),'yyyy-MM-dd'))<=90

hive sql無法識別上述這種指定分區的方式,可以指定具體的日期或其他方式解決,如sdt>=date_format(date_sub(from_unixtime(unix_timestamp(${sdate},'yyyyMMdd'),'yyyy-MM-dd'),90),'yyyyMMdd')


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM