Open gabri94 opened 2 years ago
Hey @gabri94 ! Thanks for posting this one! Yeah, it's definitely a great feature to have not so easy to implement though. The thing is there're also half-hour timezones like India Standard Time. If we'll go further there're also different daylight-saving time advance clock dates. So it'll definitely be some accuracy trade-offs here.
Would love to hear community opinions and proposals on what options to configure we should have here.
Hi @paveltiunov I wasn't aware of half-hour timezones. However, this could be implemented only on a subset of 'well-defined' timezones through the configuration files. I believe that most of the users are working on a small subset of TZs (UTC, CET, EST, PST, etc)
@gabri94 Sounds good! That's however only one surface of that question. Another one is the clock's advance date. How do you propose to deal with differences in those? For example, it's March 27 for CET and March 13 for PST this year.
If you are interested in working on this issue, please leave a comment below and we will be happy to assign the issue to you. If this is the first time you are contributing a Pull Request to Cube.js, please check our contribution guidelines. You can also post any questions while contributing in the #contributors channel in the Cube.js Slack.
In order to use preaggregations with timezones we now need to specify in the configurations files a list of timezones for which cubejs generate the aggregations periodically. This makes sense when the granularity is larger than one hour, since the data might be different. However, when the granularity is one hour or less the UTC preaggregations could be used, just by shiftings the key by n-hours.