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 2016/09/26 08:14:22 UTC

[jira] [Commented] (CASSANDRA-11873) Add duration type

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

Benjamin Lerer commented on CASSANDRA-11873:
--------------------------------------------

|[trunk|https://github.com/blerer/cassandra/tree/11873-trunk]|[utests|http://cassci.datastax.com/view/Dev/view/blerer/job/blerer-11873-trunk-testall/7/]|[dtests|http://cassci.datastax.com/view/Dev/view/blerer/job/blerer-11873-trunk-dtest/6/]|

The patch add the DurationType. Internally, the data are stored as 3 vints: one for the number of months, one for the number of days and one for the number of nanoseconds. This will allow the type to work properly with daylight saving if needed.
The type is, as discussed previously, non comparable. Its main goal being to simplify CQL queries for time series data.
The type support:
* Simple litterals (e.g. {{2mo10d12h}}: 2 months 10 days and 12 hours) with the following symbols (case insensitive):
    * {{y}}: years
    * {{mo}}: months
    * {{w}}: weeks
    * {{d}}: days
    * {{h}}: hours
    * {{m}}: minutes
    * {{s}}: seconds
    * {{ms}}: milliseconds
    * {{µs}} or {{us}}: microseconds
    * {{ns}}: nanoseconds
* ISO 8601 "format with designators": {{PnYnMnDTnHnMnS}} or {{PnW}} (e.g  {{P2M10DT12H}}: 2 months 10 days and 12 hours
* ISO 8601 "alternative format": {{PYYYY-MM-DDThh:mm:ss}} (e.g  {{P0000-02-10T12:00:00}}: 2 months 10 days and 12 hours
 

> Add duration type
> -----------------
>
>                 Key: CASSANDRA-11873
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11873
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL
>            Reporter: Benjamin Lerer
>            Assignee: Benjamin Lerer
>              Labels: client-impacting, doc-impacting
>             Fix For: 3.x
>
>
> For CASSANDRA-11871 or to allow queries with {{WHERE}} clause like:
> {{... WHERE reading_time < now() - 2h}}, we need to support some duration type.
> In my opinion, it should be represented internally as a number of microseconds.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)