You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Benjamin Lerer (JIRA)" <ji...@apache.org> on 2018/09/17 10:13:01 UTC

[jira] [Commented] (CASSANDRA-14724) Duration addition to Date/Timestamp is broken for leapseconds

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

Benjamin Lerer commented on CASSANDRA-14724:
--------------------------------------------

Lets first focus on the problem of {{DST boundaries}}.
 
{{Durations}} as explained [here|http://cassandra.apache.org/doc/latest/cql/types.html#working-with-durations] contains 3 integers which are: a number of months, a number of days and a number of nanoseconds. This is due to the fact that the number of days in a month can change, and a day can have 23 or 25 hours depending on the daylight saving.

If you want to fetch all the data from the last 2 days but do not care that the day lasted 23, 24 or 25 hours you should query the data using a query like {{SELECT \* FROM myTable WHERE pk = `XXX` AND operationTime > ? -  2d}}. If instead you want to fetch all the data from the last 2 hours but do not care about the fact that during that time your time changed due to daylight saving you should us {{SELECT \* FROM myTable WHERE pk = `XXX` AND operationTime > ? -  2h}}.

In my opinion for DST it is the correct behavior because it allows you to query exactly the data that you want.

Leap seconds are a much more complex problem because the Java libraries does not really handle leap seconds either. By consequence there is not much that we can do here.

   


 

> Duration addition to Date/Timestamp is broken for leapseconds
> -------------------------------------------------------------
>
>                 Key: CASSANDRA-14724
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14724
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Benedict
>            Assignee: Benjamin Lerer
>            Priority: Major
>              Labels: correctness
>
> Hours, Minutes and Seconds are not always of the same duration; it varies when they cross a leap second (or DST boundary).  When we add durations to instants, we do not account for this (as we have by then lost the necessary information).  Duration should take (and store) all components of time.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org