MaxGekk edited a comment on issue #26134: [SPARK-29486][SQL] CalendarInterval 
should have 3 fields: months, days and microseconds
URL: https://github.com/apache/spark/pull/26134#issuecomment-542639106
 
 
   > ... but one day interval may not.
   
   As I can understand, new `microseconds` field means actual time duration 
inside of a day, correct? Back to the example, it means:
   ```
   timestamp'2019-11-03 01:59:59 PST' + interval 2 seconds = 
timestamp'2019-11-03 01:00:01 PST'
   ```
   and to get `timestamp'2019-11-03 02:00:01 PST'`, we should add another 
interval:
   ```
   timestamp'2019-11-03 01:59:59 PST' + interval 1 hour 2 seconds = 
timestamp'2019-11-03 02:00:01 PST'
   ```
   
   > However, I'd like to know if it's allowed to set timezone to a region name 
that has undetermined timezone offset.
   
   Allowed by whom (SQL standard?)? For example, Java 8 time API allows to get 
0, 1 or 2 zone offsets depend on local timestamp, see 
https://docs.oracle.com/javase/8/docs/api/java/time/zone/ZoneRules.html#getValidOffsets-java.time.LocalDateTime-
 , see:
   ```
   The mapping from a local date-time to an offset is not straightforward. 
There are three cases:
    -   Normal, with one valid offset. For the vast majority of the year, the 
normal case applies, where there is a single valid offset for the local 
date-time.
    -   Gap, with zero valid offsets. This is when clocks jump forward 
typically due to the spring daylight savings change from "winter" to "summer". 
In a gap there are local date-time values with no valid offset.
    -   Overlap, with two valid offsets. This is when clocks are set back 
typically due to the autumn daylight savings change from "summer" to "winter". 
In an overlap there are local date-time values with two valid offsets.
   ```
   
   
   > If it's not allowed then one day interval is always 24 hours in SQL.
   
   The SQL standard defines time zones as TIMEZONE_HOUR:TIMEZONE_MINUTE. Due to 
this, there is no issue of converting zone id (region name) to offsets.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to