superset icon indicating copy to clipboard operation
superset copied to clipboard

Issues with Druid timezones

Open noppanit opened this issue 10 years ago • 11 comments

As our Druid is in UTC, so it would be more accurate to query in UTC timezone.

From this line of code https://github.com/airbnb/caravel/blob/master/caravel/models.py#L1720. It's trying to convert to UTC. But It's trying to convert from UTC -> UTC instead of my local timezone which is EST.

For example, right now my local time is 15:06 EST and when I console the time out it's 2016-10-18 15:06:44 but that string is not timezone aware so after this conversion

from_dttm.replace(tzinfo=config.get("DRUID_TZ"))

My DRUID_TZ is tz.tzutc()

It stays as 2016-10-18 15:06:44 instead of 2016-10-18 19:06:44 which is the actual UTC timezone.

Not sure how to configure this in Caravel?

noppanit avatar Oct 18 '16 19:10 noppanit

Those methods that named tzutc and tzlocal in tz work for me...

asdf2014 avatar Feb 06 '17 07:02 asdf2014

Oh no.. They are not working when i upgrade superset from v0.13.2 into v0.15.4, even if i try to use DRUID_TZ = tz.gettz('Asia/Shanghai') :-(

asdf2014 avatar Feb 07 '17 09:02 asdf2014

I'm using v0.15.2 and DRUID_TZ=tz.tzlocal() doesn't work. :-( How can I use local timezone in superset?

JessicaDuan avatar Apr 24 '17 10:04 JessicaDuan

@JessicaDuan Hi, JessicaDuan. I have fixed some timezone problems in utils.py (https://github.com/airbnb/superset/pull/2370). If you meet the same situation, then you can try to add it.

asdf2014 avatar Apr 25 '17 07:04 asdf2014

I'm using v0.19.1, and change DRUID_TZ to tz.gettz('Asia/Shanghai'), Druid intervals is changed, add +08:00, but granularity timeZone is set to 'CST', which is not correct for Druid, timeZone should be set to 'Asia/Shanghai'.
The code is here models.py, timezone = from_dttm.tzname(), return 'CST' when set DRUID_TZ=tz.gettz('Asia/Shanghai').

tkec avatar Sep 06 '17 07:09 tkec

@tkec,we encount the same problem, have you fix it? would you please share your solution ?

LewissPan avatar Sep 11 '17 10:09 LewissPan

@LewissPan No, I don't know how to return 'Asia/Shanghai' in python. In my case, there is another dimension 'create_time', I use this dimension to group by, not use '__time', and change DRUID_TZ to tz.gettz('Asia/Shanghai'), then superset will use 'topN' to query data, intervals is added +8:00.

tkec avatar Sep 12 '17 03:09 tkec

the referenced https://github.com/apache/incubator-superset/pull/2370 was closed instead of being merged, @asdf2014 Is this still an issue or fixed by some other PR ?

nishantmonu51 avatar Sep 13 '17 13:09 nishantmonu51

Notice: this issue has been closed because it has been inactive for 221 days. Feel free to comment and request for this issue to be reopened.

mistercrunch avatar Apr 23 '18 05:04 mistercrunch

Having this issue again in 1.4.1. DRUID_TZ does nothing.

Stefan-Blandin avatar Apr 20 '22 19:04 Stefan-Blandin

Any solution for this?? @xrmx some bugs can't be resolved even after 8 years😂

Owaiskhan9654 avatar Jan 30 '24 15:01 Owaiskhan9654