Task is Failed,errorMsg: SQLException: Value ‘0000-00-00‘ can not be represented as java.sql.Date

问题原因:

tidb中的date字段可以默认为'0000-00-00',但是在spark中转换成日期的时候会报错

 case when date = '0000-00-00 00:00:00' then '1970-01-01 00:00:00' else date end as new_date

把默认值调整一下,即可

你可能感兴趣的:(sql,hive,spark)