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

Joshua McKenzie commented on CASSANDRA-7523:
--------------------------------------------

Updated branches available:
[Cassandra 
changes|https://github.com/josh-mckenzie/cassandra/compare/7523_squashed]
[Python driver 
changes|https://github.com/josh-mckenzie/python-driver/compare/7523_squashed]

I've converted both types to support byte-order comparibility.  They also no 
longer accept empty strings and don't validate 0 byte inputs.  The TimeType was 
trivial as it was already bounded to byteorder comparable ranges anyway but the 
SimpleDateType change deserves a bit of explanation.

I went back and forth offline w/benedict about the SimpleDateType change - this 
implementation uses an unsigned integer w/epoch at 2^31 as our date range which 
requires some shifting and reliance on arithmetic overflow in Java thanks to 
the lack of a 1st-class unsigned integer type.  On top of that, the defined 
range is different than "epoch is 0" that most people might expect.

We could use the drivers to mask this and shift values to epoch at zero (which 
I didn't do in the attached python driver changes); I dislike implementation 
details of our internal treatment of dates pressuring non-idiomatic external 
treatments of data in this way but it goes so far as the drivers where they 
have the freedom to implement as they see fit.  It's something I'm willing to 
accept for the benefits it gives us.

I've also added more unit tests surrounding the types and their comparison and 
updated the cqlshlib unit tests and python driver unit tests to also conform to 
the new range expectations.

> add date and time types
> -----------------------
>
>                 Key: CASSANDRA-7523
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7523
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Joshua McKenzie
>            Priority: Minor
>             Fix For: 2.1.1, 3.0
>
>
> http://www.postgresql.org/docs/9.1/static/datatype-datetime.html
> (we already have timestamp; interval is out of scope for now, and see 
> CASSANDRA-6350 for discussion on timestamp-with-time-zone.  but date/time 
> should be pretty easy to add.)



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

Reply via email to