cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Ellis (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-4283) CQL3: dates are not handled correctly in slices
Date Fri, 25 May 2012 15:49:24 GMT


Jonathan Ellis commented on CASSANDRA-4283:

Two points.

First, I don't think trying to guess what the user wants here is the right solution.  They
could mean:
# "any time after 2012-06-06 00:00:00"
# "at least a day after time Y"
# "time X is a *different* day than time Y" (different from #2 when Y is not 00:00:00)

Second, for the query you give, #1 is normal and expected behavior for every relational database.

The SQL standard specifies an {{interval}} type that can be used to solve #2:

{{SELECT x FROM foo WHERE x > y + '1 day'::interval}}

The easiest way to do #3 is to force everything to truncate to the {{date}} type:

{{SELECT x FROM foo WHERE x::date > y::date}}
> CQL3: dates are not handled correctly in slices 
> ------------------------------------------------
>                 Key: CASSANDRA-4283
>                 URL:
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 1.1.0
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>              Labels: cql3
>             Fix For: 1.1.2
> Our timestamp type allows to input timestamp as dates like '2012-06-06'. However, those
don't work as expected in slice queries, as for instance:
> {noformat}
> SELECT * FROM timeline
>   WHERE k = ...
>   AND time > '2012-06-06'
>   AND time <= '2012-06-09'
> {noformat}
> will return timestamps from '2012-06-06' and not those from '2012-06-09'. The reason
being of course that we always translate a date the same way, using 0 for whichever part is
not precised.
> A reasonably simple fix could be to add a new fromString(String s, boolean gt) method
to AbstractType that is used when the the string should be interpreted in an inequality (the
boolean gt would then say which kind of inequality).

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message