Support Questions

Find answers, ask questions, and share your expertise

hive unix_timestamp() returns allways one

avatar
Champion Alumni

Hello,

 

I need to compare a date with today date so I want to use the function unix_timestamp(). 

However this function returns one (1970-01-01 00:00:01).

 

Note:

- The servers date is correctly setted up. 

- I use an AWS infrastructure

 

What else should I check in order to make this function work?

 

thank you!

GHERMAN Alina
1 ACCEPTED SOLUTION

avatar
Contributor

I guess you mean Impala.

 

Impala:

 

select unix_timestamp()

result: 1

 

Hive:

 

select unix_timestamp()

result: 1421835925

View solution in original post

3 REPLIES 3

avatar
Contributor

Hi, Alina

 

You should use the following:

select unix_timestamp(now())

 

 

Thanks

avatar
Champion Alumni

With the given sintax I get:

error while compiling statement: failed: semanticexception [error 10011]: line 1:22 invalid function 'now'

 My query:

select unix_timestamp(now()) from test_kpi_data;

 

 

Thank you!

GHERMAN Alina

avatar
Contributor

I guess you mean Impala.

 

Impala:

 

select unix_timestamp()

result: 1

 

Hive:

 

select unix_timestamp()

result: 1421835925