0

all

I created an external table in my Hive 1.2 database. Check 5 first rows:

hive> select dt_locacao from 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 I try to use to_date function...

hive> select to_date(dt_locacao) from locacao_aux_externa limit 5;
OK
NULL
NULL
NULL
NULL
NULL

Notice that I used the correct format: YYYY-MM-DD.

And, more surprisingly, when I pick just one date...

hive> select to_date('2010-11-21');
OK
2010-11-21
Time taken: 0.187 seconds, Fetched: 1 row(s)

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

Just to clarify, I've gotten this error while trying to load external data to an ORC one.

Thanks in advance for any help.

1 Answers1

0

if replace is not in your version, try this

select to_date(regexp_replace("'2010-11-21'","'",""));
hlagos
  • 7,690
  • 3
  • 23
  • 41