You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Billy Liu (JIRA)" <ji...@apache.org> on 2017/10/20 05:31:00 UTC

[jira] [Commented] (KYLIN-2952) dynamic cube build for time(statTime and endTime)

    [ https://issues.apache.org/jira/browse/KYLIN-2952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16212188#comment-16212188 ] 

Billy Liu commented on KYLIN-2952:
----------------------------------

The epoch has no timezone info. All API use epoch only. What's your proposal or question?

> dynamic cube build for time(statTime and endTime)
> -------------------------------------------------
>
>                 Key: KYLIN-2952
>                 URL: https://issues.apache.org/jira/browse/KYLIN-2952
>             Project: Kylin
>          Issue Type: Improvement
>          Components: REST Service
>    Affects Versions: v1.6.0
>         Environment: linux
>            Reporter: wenxue lin
>            Assignee: Zhong,Jason
>            Priority: Minor
>
> ex => curl -X PUT -u "ADMIN:KYLIN" -H "Content-Type:application/json;charset=utf-8" -d '{"startTime":1508601600000,"endTime":1508688000000,"buildType":"BUILD"}' http://host:port/kylin/api/cubes/bi_dispatch_waiting_service_cube/rebuild
> desc :
>  rest api param is startTime:1508601600000(2017-10-22) and endTime:1508688000000(2017-10-23), but the actual time of building the cube is 1 day ahead of schedule (actually 8 hours ahead of schedule) =》【2017-10-21~2017-10-22】,But using kylinUI build without question, the actual view kylin code, found that is because the kylin on the server side source code for configuration of GMT rather than use the timezone of fixed GMT + 8, and front-end UI will according to the configuration of the timezone is transformed to the time of the page to add GMT + 8 time, then the back-end to GMT + 8 time in into GMT time, so the kylinUI cube build time without error, and using restAPI build cube time not making timezone 8 hours is not accurate time difference problem。
> *for code:*
> kylinProperties.js
> this.getTimeZone = function () {
>     if (!this.timezone) {
>       this.timezone = this.getProperty("kylin.rest.timezone").trim();
>     }
>     return this.timezone;
> }
> org.apache.kylin.cube.CubeSegment
> public static String makeSegmentName(long startDate, long endDate, long startOffset, long endOffset) {
>     if (startOffset != 0 || endOffset != 0) {
>         if (startOffset == 0 && (endOffset == 0 || endOffset == Long.MAX_VALUE)) {
>             return "FULL_BUILD";
>         }
>         return startOffset + "_" + endOffset;
>     }
>     // using time
>     SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
>     dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
>     return dateFormat.format(startDate) + "_" + dateFormat.format(endDate);
> }
> org.apache.kylin.common.util.DateFormat:
> public static FastDateFormat getDateFormat(String datePattern) {
>     FastDateFormat r = formatMap.get(datePattern);
>     if (r == null) {
>         r = FastDateFormat.getInstance(datePattern, TimeZone.getTimeZone("GMT")); // NOTE: this must be GMT to calculate epoch date correctly
>         formatMap.put(datePattern, r);
>     }
>     return r;
> }



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)