hadoop - Split function in hive not working -
i have column name date_of_birth
date in format 1978-07-23
.
i trying code splitting, not working.
select case when split(date_of_birth,'\\-')[2] < 1900 '1900-01-01 00:00:00' else cast(from_unixtime(unix_timestamp(date_of_birth, 'm/d/yyyy')) string) end dob rd_hr.wd_employees_history
after converting date yyyy/mm/dd
, take greatest value between '1900-01-01' , date_of_birth:
select greatest(from_unixtime(unix_timestamp(date_of_birth, 'mm/dd/yyyy')), '1900-01-01 00:00:00') dob rd_hr.wd_employees_history
casting date return null
, see: https://cwiki.apache.org/confluence/display/hive/languagemanual+types#languagemanualtypes-timestampstimestamptimestamps
Comments
Post a Comment