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 2015/05/21 15:09:00 UTC

[jira] [Updated] (CASSANDRA-9229) Add functions to convert timeuuid to date or time

     [ https://issues.apache.org/jira/browse/CASSANDRA-9229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Lerer updated CASSANDRA-9229:
--------------------------------------
    Attachment: CASSANDRA-9229-V2.txt

The new patch fix my misundersanting of the new types. Take into account the review comments and provide new functions for converting:
* from {{timeuuid}} to {{timestamp}}
* from {{timeuuid}} to {{date}}
* from {{timeuuid}} to {{unix timestamp}}
* from {{timestamp}} to {{date}}
* from {{timestamp}} to {{unix timestamp}}
* from {{date}} to {{timestamp}}
* from {{date}} to {{unix timestamp}}

I decided to leave aside the conversions into {{TimeType}} as they can be too confusing.

> Add functions to convert timeuuid to date or time
> -------------------------------------------------
>
>                 Key: CASSANDRA-9229
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9229
>             Project: Cassandra
>          Issue Type: New Feature
>            Reporter: Michaël Figuière
>            Assignee: Benjamin Lerer
>              Labels: cql, doc-impacting
>             Fix For: 3.x
>
>         Attachments: CASSANDRA-9229-V2.txt, CASSANDRA-9229.txt
>
>
> As CASSANDRA-7523 brings the {{date}} and {{time}} native types to Cassandra, it would be useful to add builtin function to convert {{timeuuid}} to these two new types, just like {{dateOf()}} is doing for timestamps.
> {{timeOf()}} would extract the time component from a {{timeuuid}}. Example use case could be at insert time with for instance {{timeOf(now())}}, as well as at read time to compare the time component of a {{timeuuid}} column in a {{WHERE}} clause.
> The use cases would be similar for {{date}} but the solution is slightly less obvious, as in a perfect world we would want {{dateOf()}} to convert to {{date}} and {{timestampOf()}} for {{timestamp}}, unfortunately {{dateOf()}} already exist and convert to a {{timestamp}}, not a {{date}}. Making this change would break many existing CQL queries which is not acceptable. Therefore we could use a different name formatting logic such as {{toDate}} or {{dateFrom}}. We could then also consider using this new name convention for the 3 dates related types and just have {{dateOf}} becoming a deprecated alias.



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