hadoop - Can anyone tell me why I'm getting null when using to_date hive (version 1.2) function? -


all

i created external table in hive 1.2 database. check 5 first rows:

hive> select dt_locacao locacao_aux_externa limit 5; ok '2010-11-21' '2009-03-20' '2010-02-16' '2012-12-20' '2017-12-19' time taken: 0.253 seconds, fetched: 5 row(s) 

however, if try use to_date function...

hive> select to_date(dt_locacao) locacao_aux_externa limit 5; ok null null null null null 

notice used correct format: yyyy-mm-dd.

and, more surprisingly, when pick 1 date...

hive> select to_date('2010-11-21'); ok 2010-11-21 time taken: 0.187 seconds, fetched: 1 row(s) 

i got expected result (no matter if use single or double quotes)

just clarify, i've gotten error while trying load external data orc one.

thanks in advance help.

if replace not in version, try this

select to_date(regexp_replace("'2010-11-21'","'","")); 

Comments