hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ayazur Rehman <rehman.ayazu...@gmail.com>
Subject Re: current_date function in hive
Date Wed, 03 Jun 2015 17:57:23 GMT
Hi everyone,

Thanks for the responses. My problem is solved now.
I was not using the proper version of hive to be able to use the
current_date function.
Thanks Gopal for the UDF link.
I beleive I will have to add the udf to the hiveserver2 in order to be able
to run the query using Oozie.

On Tue, Jun 2, 2015 at 1:30 PM, Gopal Vijayaraghavan <gopalv@apache.org>
wrote:

> Hi,
>
> > You may try to_date(FROM_UNIXTIME(UNIX_TIMESTAMP()))
>
> That would be a very bad idea for query correctness.
>
> The current_date UDF was introduced because of that particular
> anti-pattern.
>
> The unix_timestamp() is evaluated when a row is read, so each row gets a
> slightly different timestamp when doing ETLs & I have seen it give
> completely incorrect results when used near midnight (i.e query kicked off
> at 11:59, executed at 00:01 next day).
>
> Plus map-reduce falure handling mandates (logically) identical outputs on
> map task retries or speculation.
>
> I¹ve recently pulled out the current_timestamp() impl out into a reusable
> UDF
> recently so that I can use that in hive-1.0.x installs as well.
>
> https://github.com/t3rmin4t0r/current-timestamp
>
> You can use that UDF JAR with hive-1.0+, the constant folding will replace
> the value in-place during compilation.
>
> Cheers,
> Gopal
>
>
>


-- 
Thanking You,
Ayazur Rehman
+1 720 917 8540

Mime
View raw message