[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16649675#comment-16649675
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user asfgit closed the pull request at:

https://github.com/apache/incubator-griffin/pull/435


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
> Fix For: 0.3.1-incubating
>
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16649672#comment-16649672
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user guoyuepeng commented on the issue:

https://github.com/apache/incubator-griffin/pull/435
  
data partition timezone is come from data connector.

https://github.com/apache/incubator-griffin/blob/master/service/src/main/java/org/apache/griffin/core/measure/entity/DataConnector.java#L158

This only relate to scheduler timezone, after tell user this timezone in UI,

I am ok for this now.

Will merge it.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16649670#comment-16649670
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user guoyuepeng commented on the issue:

https://github.com/apache/incubator-griffin/pull/435
  
let me check 


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16649669#comment-16649669
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user chemikadze commented on the issue:

https://github.com/apache/incubator-griffin/pull/435
  
@guoyuepeng @ahutsunshine is there anything left preventing the merge?


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16649666#comment-16649666
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user ahutsunshine commented on the issue:

https://github.com/apache/incubator-griffin/pull/435
  
> cron.time.zone

you are right.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16649660#comment-16649660
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user chemikadze commented on the issue:

https://github.com/apache/incubator-griffin/pull/435
  
@ahutsunshine I've found only usage of cron.time.zone is only during 
schedule creation: 
https://github.com/apache/incubator-griffin/blob/master/service/src/main/java/org/apache/griffin/core/job/JobServiceImpl.java#L423
At the same time I see partition time zone is coming from data.time.zone 
set in measure JSON: 
https://github.com/apache/incubator-griffin/blob/master/service/src/main/java/org/apache/griffin/core/job/JobInstance.java#L221
 

Am I missing something?


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16649652#comment-16649652
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user ahutsunshine commented on the issue:

https://github.com/apache/incubator-griffin/pull/435
  
> Added time zone information to batch UI:
> https://user-images.githubusercontent.com/867294/46914000-4c567a00-cf4c-11e8-85cb-be6428e91895.png;>



> Added time zone information to batch UI:
> https://user-images.githubusercontent.com/867294/46914000-4c567a00-cf4c-11e8-85cb-be6428e91895.png;>

Actually, this timezone is used for data partition not scheduling time. For 
example, Converting hive partition format, such as dt=#MMdd# AND hour=#HH#, 
to specific date, such as dt=20181015 AND hour=01. So I think we'd better 
revise the hints 'Cron expression is using brower's time zone'.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16649289#comment-16649289
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user chemikadze commented on the issue:

https://github.com/apache/incubator-griffin/pull/435
  
Added time zone information to batch UI:
https://user-images.githubusercontent.com/867294/46914000-4c567a00-cf4c-11e8-85cb-be6428e91895.png;>



> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16649274#comment-16649274
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user chemikadze commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224981272
  
--- Diff: ui/angular/src/app/job/create-job/batch/batch.component.ts ---
@@ -134,8 +134,8 @@ export class BatchComponent implements OnInit, 
AfterViewChecked {
   return false;
 }
 this.measureid = this.getMeasureId();
-let time = new Date().getTimezoneOffset() / 60;
-let timezone = "GMT" + time + ":00";
+let time = -(new Date().getTimezoneOffset() / 60);
--- End diff --

> IC, this timezone is used for data partition.

As far as I see from code and behavior, this time zone is used only to 
interpret cron expression.
Data partitions are referring to timezones configured on datasets 
themselves.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


Re: [jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-13 Thread William Guo
don't worry, we can do it in angular side.

On Sun, Oct 14, 2018 at 4:17 AM ASF GitHub Bot (JIRA) 
wrote:

>
> [
> https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16649102#comment-16649102
> ]
>
> ASF GitHub Bot commented on GRIFFIN-206:
> 
>
> Github user chemikadze commented on a diff in the pull request:
>
>
> https://github.com/apache/incubator-griffin/pull/435#discussion_r224970940
>
> --- Diff: ui/angular/src/app/job/create-job/batch/batch.component.ts
> ---
> @@ -134,8 +134,8 @@ export class BatchComponent implements OnInit,
> AfterViewChecked {
>return false;
>  }
>  this.measureid = this.getMeasureId();
> -let time = new Date().getTimezoneOffset() / 60;
> -let timezone = "GMT" + time + ":00";
> +let time = -(new Date().getTimezoneOffset() / 60);
> --- End diff --
>
> @guoyuepeng @ashutakGG Moved to utility function. Angular is not my
> specialty, I was really surprised how much complexity Angular community has
> about it.
>
>
> > Wrong sign of time zone offset when created from UI
> > ---
> >
> > Key: GRIFFIN-206
> > URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> > Project: Griffin (Incubating)
> >  Issue Type: Bug
> >Reporter: Nikolay Sokolov
> >Assignee: Nikolay Sokolov
> >Priority: Major
> >
> > When job is created from UI, time zone offset is created by this piece
> of code:
> > {code:none}
> > let time = new Date().getTimezoneOffset() / 60;
> > let timezone = "GMT" + time + ":00";
> > {code}
> > Problem is, that for GMT-7 it yields positive number, resulting in
> calculated timezone to be GMT+7.
> > Turns out that that some formats are not parsed properly, at least
> UTCXX:XX format used by UI is not processed correctly, and GMTXX:XX
> (without signs):
> > {code:none}
> > scala> java.util.TimeZone.getTimeZone("GMT6")
> > res9: java.util.TimeZone =
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> > scala> java.util.TimeZone.getTimeZone("GMT+6")
> > res10: java.util.TimeZone =
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> > scala> java.util.TimeZone.getTimeZone("UTC+6")
> > res11: java.util.TimeZone =
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> > scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> > res12: java.util.TimeZone =
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> > {code}
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v7.6.3#76005)
>


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-13 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16649102#comment-16649102
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user chemikadze commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224970940
  
--- Diff: ui/angular/src/app/job/create-job/batch/batch.component.ts ---
@@ -134,8 +134,8 @@ export class BatchComponent implements OnInit, 
AfterViewChecked {
   return false;
 }
 this.measureid = this.getMeasureId();
-let time = new Date().getTimezoneOffset() / 60;
-let timezone = "GMT" + time + ":00";
+let time = -(new Date().getTimezoneOffset() / 60);
--- End diff --

@guoyuepeng @ashutakGG Moved to utility function. Angular is not my 
specialty, I was really surprised how much complexity Angular community has 
about it.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-13 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16648866#comment-16648866
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user guoyuepeng commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224955984
  
--- Diff: service/src/main/java/org/apache/griffin/core/util/TimeUtil.java 
---
@@ -148,4 +149,11 @@ private static String refreshEscapeHashTag(String str) 
{
 return str.replaceAll(escapeHashTagPattern, hashTag);
 }
 
+public static TimeZone getTimeZone(String timezone) {
+if (StringUtils.isEmpty(timezone)) {
+return TimeZone.getDefault();
+}
+return TimeZone.getTimeZone(timezone);
+}
+
 }
--- End diff --

yes, it is utility function.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-13 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16648864#comment-16648864
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user guoyuepeng commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224948342
  
--- Diff: ui/angular/src/app/job/create-job/batch/batch.component.ts ---
@@ -134,8 +134,8 @@ export class BatchComponent implements OnInit, 
AfterViewChecked {
   return false;
 }
 this.measureid = this.getMeasureId();
-let time = new Date().getTimezoneOffset() / 60;
-let timezone = "GMT" + time + ":00";
+let time = -(new Date().getTimezoneOffset() / 60);
--- End diff --

I have little concern about this.
1. if we want to get the timezone based on current time in browser, we need 
to extract and rename the function as gettimezoneBasedonTime
2. why client want to control the schedule timezone, the timezone should be 
owned by cluster, client should only need to control schedule time, right? 



> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-13 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16648789#comment-16648789
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user chemikadze commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224952112
  
--- Diff: service/src/main/java/org/apache/griffin/core/util/TimeUtil.java 
---
@@ -148,4 +149,11 @@ private static String refreshEscapeHashTag(String str) 
{
 return str.replaceAll(escapeHashTagPattern, hashTag);
 }
 
+public static TimeZone getTimeZone(String timezone) {
+if (StringUtils.isEmpty(timezone)) {
+return TimeZone.getDefault();
+}
+return TimeZone.getTimeZone(timezone);
+}
+
 }
--- End diff --

@ahutsunshine Well, it's about time, it's utility function, static makes it 
easier to test. Felt like it belongs here.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-13 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16648788#comment-16648788
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user ahutsunshine commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224951998
  
--- Diff: service/src/main/java/org/apache/griffin/core/util/TimeUtil.java 
---
@@ -148,4 +149,11 @@ private static String refreshEscapeHashTag(String str) 
{
 return str.replaceAll(escapeHashTagPattern, hashTag);
 }
 
+public static TimeZone getTimeZone(String timezone) {
+if (StringUtils.isEmpty(timezone)) {
+return TimeZone.getDefault();
+}
+return TimeZone.getTimeZone(timezone);
+}
+
 }
--- End diff --

@chemikadze 
I suggest this code be kept in its original place. Currently just modify ui 
code to fix bug.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-12 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16648705#comment-16648705
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user guoyuepeng commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224947629
  
--- Diff: service/src/main/java/org/apache/griffin/core/util/TimeUtil.java 
---
@@ -148,4 +149,11 @@ private static String refreshEscapeHashTag(String str) 
{
 return str.replaceAll(escapeHashTagPattern, hashTag);
 }
 
+public static TimeZone getTimeZone(String timezone) {
+if (StringUtils.isEmpty(timezone)) {
+return TimeZone.getDefault();
+}
+return TimeZone.getTimeZone(timezone);
+}
+
 }
--- End diff --

LGTM, refactor to better place.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-12 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16648606#comment-16648606
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user chemikadze commented on the issue:

https://github.com/apache/incubator-griffin/pull/435
  
@ahutsunshine I was thinking on handling UTCxxx format on backend to fix 
existing jobs, but from other hand, this feels like unnecessary breaking 
change. I've provided UI fix for now.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-12 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16647548#comment-16647548
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user ahutsunshine commented on the issue:

https://github.com/apache/incubator-griffin/pull/435
  
@chemikadze 
You are right. In backend, the method of getTimeZone always returns GMT 
timezone for  UTC-1 or UTC+01:00 or other similar formats, as the given 
timezone ID cannot be understood. Currently, I have no better idea to parse 
different timezone formats in backend. I prefer to solve the problem in front 
end using a full name such as "America/Los_Angeles", or a standard ID such as 
"GMT-1:00". Do you have better idea for backend ? 


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-11 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16647108#comment-16647108
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user chemikadze commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224622499
  
--- Diff: ui/angular/src/app/job/create-job/batch/batch.component.ts ---
@@ -134,8 +134,8 @@ export class BatchComponent implements OnInit, 
AfterViewChecked {
   return false;
 }
 this.measureid = this.getMeasureId();
-let time = new Date().getTimezoneOffset() / 60;
-let timezone = "GMT" + time + ":00";
+let time = -(new Date().getTimezoneOffset() / 60);
--- End diff --

Looks like there big bunch of different techniques, half of them is based 
on regex and way browser formats date, another half requires third-party 
libraries. Apparently, `getTimeZoneOffset()` is "accepted answer" over here: 
https://stackoverflow.com/questions/1091372/getting-the-clients-timezone-in-javascript


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-11 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16647096#comment-16647096
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user chemikadze commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224620459
  
--- Diff: 
ui/angular/src/app/measure/create-measure/configuration/configuration.component.ts
 ---
@@ -56,47 +56,47 @@ export class ConfigurationComponent implements OnInit {
   };
   timetypes = ["day", "hour", "minute"];
   timetype: string;
-  timezones = [
-"UTC-12(IDL)",
-"UTC-11(MIT)",
-"UTC-10(HST)",
-"UTC-9:30(MSIT)",
-"UTC-9(AKST)",
-"UTC-8(PST)",
-"UTC-7(MST)",
-"UTC-6(CST)",
-"UTC-5(EST)",
-"UTC-4(AST)",
-"UTC-3:30(NST)",
-"UTC-3(SAT)",
-"UTC-2(BRT)",
-"UTC-1(CVT)",
-"UTC(WET,GMT)",
-"UTC+1(CET)",
-"UTC+2(EET)",
-"UTC+3(MSK)",
-"UTC+3:30(IRT)",
-"UTC+4(META)",
-"UTC+4:30(AFT)",
-"UTC+5(METB)",
-"UTC+5:30(IDT)",
-"UTC+5:45(NPT)",
-"UTC+6(BHT)",
-"UTC+6:30(MRT)",
-"UTC+7(IST)",
-"UTC+8(EAT)",
-"UTC+8:30(KRT)",
-"UTC+9(FET)",
-"UTC+9:30(ACST)",
-"UTC+10(AEST)",
-"UTC+10:30(FAST)",
-"UTC+11(VTT)",
-"UTC+11:30(NFT)",
-"UTC+12(PSTB)",
-"UTC+12:45(CIT)",
-"UTC+13(PSTC)",
-"UTC+14(PSTD)"
-  ];
+  timezones: Map = new Map([
+["UTC-12(IDL)", "GMT-12"],
+["UTC-11(MIT)", "GMT-11"],
+["UTC-10(HST)", "GMT-10"],
+["UTC-9:30(MSIT)", "GMT-9:30"],
+["UTC-9(AKST)", "GMT-9"],
+["UTC-8(PST)", "GMT-8"],
+["UTC-7(MST)", "GMT-7"],
+["UTC-6(CST)", "GMT-6"],
+["UTC-5(EST)", "GMT-5"],
+["UTC-4(AST)", "GMT-4"],
+["UTC-3:30(NST)", "GMT-3:30"],
+["UTC-3(SAT)", "GMT-3"],
+["UTC-2(BRT)", "GMT-2"],
+["UTC-1(CVT)", "GMT-1"],
+["UTC(WET,GMT)", "GMT"],
+["UTC+1(CET)", "GMT+1"],
+["UTC+2(EET)", "GMT+2"],
+["UTC+3(MSK)", "GMT+3"],
+["UTC+3:30(IRT)", "GMT+3:30"],
+["UTC+4(META)", "GMT+4"],
+["UTC+4:30(AFT)", "GMT+4:30"],
+["UTC+5(METB)", "GMT+5"],
+["UTC+5:30(IDT)", "GMT+5:30"],
+["UTC+5:45(NPT)", "GMT+5:45"],
+["UTC+6(BHT)", "GMT+6"],
+["UTC+6:30(MRT)", "GMT+6:30"],
+["UTC+7(IST)", "GMT+7"],
+["UTC+8(EAT)", "GMT+8"],
+["UTC+8:30(KRT)", "GMT+8:30"],
+["UTC+9(FET)", "GMT+9"],
+["UTC+9:30(ACST)", "GMT+9:30"],
+["UTC+10(AEST)", "GMT+10"],
+["UTC+10:30(FAST)", "GMT+10:30"],
+["UTC+11(VTT)", "GMT+11"],
+["UTC+11:30(NFT)", "GMT+11:30"],
+["UTC+12(PSTB)", "GMT+12"],
+["UTC+12:45(CIT)", "GMT+12:45"],
+["UTC+13(PSTC)", "GMT+13"],
+["UTC+14(PSTD)", "GMT+15"],
--- End diff --

good catch, thanks


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-11 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16646880#comment-16646880
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user gavlyukovskiy commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224560857
  
--- Diff: 
service/src/test/java/org/apache/griffin/core/util/TimeUtilTest.java ---
@@ -110,4 +111,36 @@ public void testFormatWithIllegalException() {
 TimeUtil.format(format, time, TimeZone.getTimeZone(timeZone));
 }
 
+@Test
+public void testGetTimeZone() {
+HashMap tests = new HashMap<>();
+tests.put("", TimeZone.getDefault().getID());
+// standard cases
+tests.put("GMT", "GMT");
+tests.put("GMT+1", "GMT+01:00");
+tests.put("GMT+1:00", "GMT+01:00");
+tests.put("GMT+01:00", "GMT+01:00");
+tests.put("GMT-1", "GMT-01:00");
+tests.put("GMT-1:00", "GMT-01:00");
+tests.put("GMT-01:00", "GMT-01:00");
+// values pushed by UI for jobs
+tests.put("GMT1", "GMT");
+tests.put("GMT1:00", "GMT");
+tests.put("GMT01:00", "GMT");
+// values generated by UI for datasets in a past
+tests.put("UTC1", "GMT");
+tests.put("UTC1:00", "GMT");
+tests.put("UTC01:00", "GMT");
+tests.put("UTC-1", "GMT");
+tests.put("UTC-1:00", "GMT");
+tests.put("UTC-01:00", "GMT");
+for (HashMap.Entry e: tests.entrySet()) {
--- End diff --

```
tests.forEach((key, value) -> {...})
```
Looks even better :)


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-11 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16646548#comment-16646548
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user ashutakGG commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224482419
  
--- Diff: ui/angular/src/app/job/create-job/batch/batch.component.ts ---
@@ -134,8 +134,8 @@ export class BatchComponent implements OnInit, 
AfterViewChecked {
   return false;
 }
 this.measureid = this.getMeasureId();
-let time = new Date().getTimezoneOffset() / 60;
-let timezone = "GMT" + time + ":00";
+let time = -(new Date().getTimezoneOffset() / 60);
--- End diff --

Is there some best practices regarding such logic in angular?


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-11 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16646543#comment-16646543
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user ashutakGG commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224481345
  
--- Diff: 
ui/angular/src/app/measure/create-measure/configuration/configuration.component.ts
 ---
@@ -56,47 +56,47 @@ export class ConfigurationComponent implements OnInit {
   };
   timetypes = ["day", "hour", "minute"];
   timetype: string;
-  timezones = [
-"UTC-12(IDL)",
-"UTC-11(MIT)",
-"UTC-10(HST)",
-"UTC-9:30(MSIT)",
-"UTC-9(AKST)",
-"UTC-8(PST)",
-"UTC-7(MST)",
-"UTC-6(CST)",
-"UTC-5(EST)",
-"UTC-4(AST)",
-"UTC-3:30(NST)",
-"UTC-3(SAT)",
-"UTC-2(BRT)",
-"UTC-1(CVT)",
-"UTC(WET,GMT)",
-"UTC+1(CET)",
-"UTC+2(EET)",
-"UTC+3(MSK)",
-"UTC+3:30(IRT)",
-"UTC+4(META)",
-"UTC+4:30(AFT)",
-"UTC+5(METB)",
-"UTC+5:30(IDT)",
-"UTC+5:45(NPT)",
-"UTC+6(BHT)",
-"UTC+6:30(MRT)",
-"UTC+7(IST)",
-"UTC+8(EAT)",
-"UTC+8:30(KRT)",
-"UTC+9(FET)",
-"UTC+9:30(ACST)",
-"UTC+10(AEST)",
-"UTC+10:30(FAST)",
-"UTC+11(VTT)",
-"UTC+11:30(NFT)",
-"UTC+12(PSTB)",
-"UTC+12:45(CIT)",
-"UTC+13(PSTC)",
-"UTC+14(PSTD)"
-  ];
+  timezones: Map = new Map([
+["UTC-12(IDL)", "GMT-12"],
+["UTC-11(MIT)", "GMT-11"],
+["UTC-10(HST)", "GMT-10"],
+["UTC-9:30(MSIT)", "GMT-9:30"],
+["UTC-9(AKST)", "GMT-9"],
+["UTC-8(PST)", "GMT-8"],
+["UTC-7(MST)", "GMT-7"],
+["UTC-6(CST)", "GMT-6"],
+["UTC-5(EST)", "GMT-5"],
+["UTC-4(AST)", "GMT-4"],
+["UTC-3:30(NST)", "GMT-3:30"],
+["UTC-3(SAT)", "GMT-3"],
+["UTC-2(BRT)", "GMT-2"],
+["UTC-1(CVT)", "GMT-1"],
+["UTC(WET,GMT)", "GMT"],
+["UTC+1(CET)", "GMT+1"],
+["UTC+2(EET)", "GMT+2"],
+["UTC+3(MSK)", "GMT+3"],
+["UTC+3:30(IRT)", "GMT+3:30"],
+["UTC+4(META)", "GMT+4"],
+["UTC+4:30(AFT)", "GMT+4:30"],
+["UTC+5(METB)", "GMT+5"],
+["UTC+5:30(IDT)", "GMT+5:30"],
+["UTC+5:45(NPT)", "GMT+5:45"],
+["UTC+6(BHT)", "GMT+6"],
+["UTC+6:30(MRT)", "GMT+6:30"],
+["UTC+7(IST)", "GMT+7"],
+["UTC+8(EAT)", "GMT+8"],
+["UTC+8:30(KRT)", "GMT+8:30"],
+["UTC+9(FET)", "GMT+9"],
+["UTC+9:30(ACST)", "GMT+9:30"],
+["UTC+10(AEST)", "GMT+10"],
+["UTC+10:30(FAST)", "GMT+10:30"],
+["UTC+11(VTT)", "GMT+11"],
+["UTC+11:30(NFT)", "GMT+11:30"],
+["UTC+12(PSTB)", "GMT+12"],
+["UTC+12:45(CIT)", "GMT+12:45"],
+["UTC+13(PSTC)", "GMT+13"],
+["UTC+14(PSTD)", "GMT+15"],
--- End diff --

14 -> 15? Is it done intentionally?


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-11 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16646542#comment-16646542
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user ashutakGG commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224461713
  
--- Diff: 
service/src/test/java/org/apache/griffin/core/util/TimeUtilTest.java ---
@@ -110,4 +111,36 @@ public void testFormatWithIllegalException() {
 TimeUtil.format(format, time, TimeZone.getTimeZone(timeZone));
 }
 
+@Test
+public void testGetTimeZone() {
+HashMap tests = new HashMap<>();
+tests.put("", TimeZone.getDefault().getID());
+// standard cases
+tests.put("GMT", "GMT");
+tests.put("GMT+1", "GMT+01:00");
+tests.put("GMT+1:00", "GMT+01:00");
+tests.put("GMT+01:00", "GMT+01:00");
+tests.put("GMT-1", "GMT-01:00");
+tests.put("GMT-1:00", "GMT-01:00");
+tests.put("GMT-01:00", "GMT-01:00");
+// values pushed by UI for jobs
+tests.put("GMT1", "GMT");
+tests.put("GMT1:00", "GMT");
+tests.put("GMT01:00", "GMT");
+// values generated by UI for datasets in a past
+tests.put("UTC1", "GMT");
+tests.put("UTC1:00", "GMT");
+tests.put("UTC01:00", "GMT");
+tests.put("UTC-1", "GMT");
+tests.put("UTC-1:00", "GMT");
+tests.put("UTC-01:00", "GMT");
+for (HashMap.Entry e: tests.entrySet()) {
--- End diff --

Consider 
```
tests.entrySet().forEach(e -> {...}
```
as an option.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-11 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16646540#comment-16646540
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user ashutakGG commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224459867
  
--- Diff: 
service/src/test/java/org/apache/griffin/core/util/TimeUtilTest.java ---
@@ -110,4 +111,36 @@ public void testFormatWithIllegalException() {
 TimeUtil.format(format, time, TimeZone.getTimeZone(timeZone));
 }
 
+@Test
+public void testGetTimeZone() {
+HashMap tests = new HashMap<>();
--- End diff --

Please, use interface name instead of implementation. 


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-11 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16646541#comment-16646541
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user ashutakGG commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224479994
  
--- Diff: ui/angular/src/app/job/create-job/batch/batch.component.ts ---
@@ -134,8 +134,8 @@ export class BatchComponent implements OnInit, 
AfterViewChecked {
   return false;
 }
 this.measureid = this.getMeasureId();
-let time = new Date().getTimezoneOffset() / 60;
-let timezone = "GMT" + time + ":00";
+let time = -(new Date().getTimezoneOffset() / 60);
--- End diff --

Looks like a hack (this and next lines). Probably worth to add a comment. 
Or even extract common function as long as it happens twice in a code.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-11 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16646539#comment-16646539
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user ashutakGG commented on a diff in the pull request:

https://github.com/apache/incubator-griffin/pull/435#discussion_r224461843
  
--- Diff: 
service/src/test/java/org/apache/griffin/core/util/TimeUtilTest.java ---
@@ -110,4 +111,36 @@ public void testFormatWithIllegalException() {
 TimeUtil.format(format, time, TimeZone.getTimeZone(timeZone));
 }
 
+@Test
+public void testGetTimeZone() {
+HashMap tests = new HashMap<>();
+tests.put("", TimeZone.getDefault().getID());
+// standard cases
+tests.put("GMT", "GMT");
+tests.put("GMT+1", "GMT+01:00");
+tests.put("GMT+1:00", "GMT+01:00");
+tests.put("GMT+01:00", "GMT+01:00");
+tests.put("GMT-1", "GMT-01:00");
+tests.put("GMT-1:00", "GMT-01:00");
+tests.put("GMT-01:00", "GMT-01:00");
+// values pushed by UI for jobs
+tests.put("GMT1", "GMT");
+tests.put("GMT1:00", "GMT");
+tests.put("GMT01:00", "GMT");
+// values generated by UI for datasets in a past
+tests.put("UTC1", "GMT");
+tests.put("UTC1:00", "GMT");
+tests.put("UTC01:00", "GMT");
+tests.put("UTC-1", "GMT");
+tests.put("UTC-1:00", "GMT");
+tests.put("UTC-01:00", "GMT");
+for (HashMap.Entry e: tests.entrySet()) {
+String input = e.getKey();
+String actual = TimeUtil.getTimeZone(e.getKey()).getID();
--- End diff --

Reuse `input` here.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-11 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16646021#comment-16646021
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user chemikadze commented on the issue:

https://github.com/apache/incubator-griffin/pull/435
  
Went with UI route for a time being, to avoid introducing any incompatible 
behavior from backend side.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-10 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16645832#comment-16645832
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user chemikadze commented on the issue:

https://github.com/apache/incubator-griffin/pull/435
  
@ahutsunshine I've traced time zone logic to your commit, are you aware of 
problem described in a ticket? Challenge is that UI format is not in sync with 
parsing logic. Basically there are two options:
 - fix behavior on backend to understand format
 - alternatively we can change UI to use right format
Fixing it on server side might be good (by making existing jobs and 
examples created with wrong format to be working), from other hand it might 
break compatibility, as jobs with malformed zones will start to run in new time 
zone. What's your take on it?


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-10 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16645644#comment-16645644
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


Github user chemikadze commented on the issue:

https://github.com/apache/incubator-griffin/pull/435
  
Looks like positive time zones without signs are not parsed properly, so 
this is not a complete fix.


> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.
> Turns out that that some formats are not parsed properly, at least UTCXX:XX 
> format used by UI is not processed correctly, and GMTXX:XX (without signs):
> {code:none}
> scala> java.util.TimeZone.getTimeZone("GMT6")
> res9: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("GMT+6")
> res10: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT+06:00",offset=2160,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC+6")
> res11: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> scala> java.util.TimeZone.getTimeZone("UTC-6(CST)")
> res12: java.util.TimeZone = 
> sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GRIFFIN-206) Wrong sign of time zone offset when created from UI

2018-10-10 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/GRIFFIN-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16645389#comment-16645389
 ] 

ASF GitHub Bot commented on GRIFFIN-206:


GitHub user chemikadze opened a pull request:

https://github.com/apache/incubator-griffin/pull/435

[GRIFFIN-206] fix job timezone when creating from UI

Demonstration:
```
> new Date()
Wed Oct 10 2018 11:30:48 GMT-0700 (Pacific Daylight Time)
> new Date().getTimezoneOffset()/60
7
```

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/chemikadze/incubator-griffin GRIFFIN-206

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-griffin/pull/435.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #435


commit 03059a27a1f7fa8a7f839681f716fe1e66e0
Author: Nikolay Sokolov 
Date:   2018-10-10T18:28:51Z

[GRIFFIN-206] fix job timezone when creating from UI




> Wrong sign of time zone offset when created from UI
> ---
>
> Key: GRIFFIN-206
> URL: https://issues.apache.org/jira/browse/GRIFFIN-206
> Project: Griffin (Incubating)
>  Issue Type: Bug
>Reporter: Nikolay Sokolov
>Assignee: Nikolay Sokolov
>Priority: Major
>
> When job is created from UI, time zone offset is created by this piece of 
> code:
> {code:none}
> let time = new Date().getTimezoneOffset() / 60;
> let timezone = "GMT" + time + ":00";
> {code}
> Problem is, that for GMT-7 it yields positive number, resulting in calculated 
> timezone to be GMT+7.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)