cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Stupp (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-9229) Add functions to convert timeuuid to date or time
Date Tue, 28 Apr 2015 16:56:06 GMT


Robert Stupp commented on CASSANDRA-9229:

Altogether LGTM - a few notes and wishes:

* {{@Override}} annotations - I think the current proposal for these annotations is: place
on overridden non-abstract methods, but not place them in implemented interface methods or
implemented abstract methods
* not sure about deprecating {{dateOf}} and {{unixtimestampOf}} - I’m fine with basically
renaming them (as you did) - but removing them in the near future (as intended by the logged
warning) will break existing applications. So I’d tend to remove the ”might be removed…”
message from the log message.
* in the unit tests: can you re-add the tests of the now deprecated functions in {{TypeTest}}
* Can you add variants of {{toTime}} and {{toDate}} that take a {{timestamp}}?
* Can you add a variant of {{toUnixTimestamp}}  that takes a {{timestamp}} and one that takes
a {{date}}?
* {{execute}} methods in {{TimeuuidFcts#toDate}}, {{toTimestamp}}, {{dateOfFct}} allocate
a some temporary objects. I’d like to see at least the {{new Date()}} go away - ideally
also the construction of {{new UUID()}}. I don’t insist of this one - it’s just about
reducing heap pressure a little bit.

> Add functions to convert timeuuid to date or time
> -------------------------------------------------
>                 Key: CASSANDRA-9229
>                 URL:
>             Project: Cassandra
>          Issue Type: New Feature
>            Reporter: Michaël Figuière
>            Assignee: Benjamin Lerer
>              Labels: cql, doc-impacting
>             Fix For: 3.0
>         Attachments: 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

View raw message