Re: from_unixtime() and epoch definition

2014-11-06 Thread Maciek
@Jason: re. Hive (…) just assumes things are in the system's local timezone, just to clarify - this is not true in case of conversions (from_unixtime()) as it respects the local system TZ settings hence the problem. TZ itself is a very hairy subject and would definitely be a big undertaking.

Re: from_unixtime() and epoch definition

2014-11-06 Thread Nitin Pawar
Hi Maciek, Jason Sorry I could not find my old code but I came up with a little code as much as I can remember. you can try the following jar https://github.com/nitinpawar/hive-udfs/tree/master/FromUnixtimeWithTZ/dist and let me know if this works for you guys. I can change it the way it needs

Re: from_unixtime() and epoch definition

2014-11-05 Thread Maciek
I see… and confirm, it's consistent with Linux/Unix output I get: date -r 0 Thu 1 Jan 1970 01:00:00 IST date Wed 5 Nov 2014 14:49:52 GMT Got some digging and it actually makes sense. Turns out Ireland didn't observe daylight saving time in years 1968-1972 as set permanently to GMT+1=IST.

Re: from_unixtime() and epoch definition

2014-11-05 Thread Jason Dere
Hive should probably at least provide a timezone option to from_unixtime(). As you mentioned, Hive doesn't really do any timezone handling, just assumes things are in the system's local timezone. It will be a bit of a bigger project to add better time zone handling to Hive timestamps. On Nov

Re: from_unixtime() and epoch definition

2014-11-05 Thread Nitin Pawar
May be a JIRA ? I remember having my own UDF for doing this. If possible I will share the code On Thu, Nov 6, 2014 at 6:22 AM, Jason Dere jd...@hortonworks.com wrote: Hive should probably at least provide a timezone option to from_unixtime(). As you mentioned, Hive doesn't really do any

Re: from_unixtime() and epoch definition

2014-11-05 Thread Jason Dere
That would be great! On Nov 5, 2014, at 10:49 PM, Nitin Pawar nitinpawar...@gmail.com wrote: May be a JIRA ? I remember having my own UDF for doing this. If possible I will share the code On Thu, Nov 6, 2014 at 6:22 AM, Jason Dere jd...@hortonworks.com wrote: Hive should probably at

Re: from_unixtime() and epoch definition

2014-11-03 Thread Maciek
I'd consider this behaviour as a bug and would like to raise it as such. Is there anyone to confirm it's the same on Hive 0.14? On Fri, Oct 31, 2014 at 3:41 PM, Maciek mac...@sonra.io wrote: Actually confirmed! It's down to the timezone settings I've moved temporarily server/client settings to

Re: from_unixtime() and epoch definition

2014-11-03 Thread Jason Dere
As Nitin mentions, the behavior is to a string representing the timestamp of that moment in the current system time zone. What are the timezone settings on your machine? $ TZ=GMT date -r 0 Thu Jan 1 00:00:00 GMT 1970 $ TZ=UTC date -r 0 Thu Jan 1 00:00:00 UTC 1970 $ TZ=Europe/London date

from_unixtime() and epoch definition

2014-10-31 Thread Maciek
Any reason why select from_unixtime(0) t0 FROM … gives 1970-01-01 01:00:00 ? By all available definitions (epoch, from_unixtime etc..) I would expect it to be 1970-01-01 01:00:00…?

Re: from_unixtime() and epoch definition

2014-10-31 Thread Nitin Pawar
Do you have a copy paste error? I see both values as same On Fri, Oct 31, 2014 at 5:30 PM, Maciek mac...@sonra.io wrote: Any reason why select from_unixtime(0) t0 FROM … gives 1970-01-01 01:00:00 ? By all available definitions (epoch, from_unixtime etc..) I would expect it to be

Re: from_unixtime() and epoch definition

2014-10-31 Thread Nitin Pawar
In hive from_unixtime is returned from the timezone which you belong to From document : from_unixtime(bigint unixtime[, string format]) : Converts the number of seconds from unix epoch (1970-01-01 00:00:00 UTC) to a string representing the timestamp of that moment in the current system time zone

Re: from_unixtime() and epoch definition

2014-10-31 Thread Maciek
Actually confirmed! It's down to the timezone settings I've moved temporarily server/client settings to 'Atlantic/Reykjavik' (no change in time comparing to what I was on (GMT), but it's permanent UTC and as such doesn't observe daylight saving. I believe this shouldn't matter (see my points from