cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (Commented) (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-4004) Add support for ReversedType
Date Sat, 14 Apr 2012 14:49:16 GMT


Sylvain Lebresne commented on CASSANDRA-4004:

The idea of my patch is that adding DESC to a field in a table declaration changes the order
of records *logically* (it also does it physically, but that is an implementation detail).
The typical example (which I think is very common) is for time series, where you're often
interested by having record "by default" in reverse time order (from the more recent to the
older). In that case a SELECT without any ORDER BY would return records directly in reverse
time order. So at least given that definition, no, I don't think there is anything to do for
the code of ORDER BY in SELECT.

I reckon there is another way to add ReversedType, which I'm assuming is what you are referring
to, which consists in *not* changing the logical order, but to change the physical order.
In which case, yes, we would have to take that into account for ORDER BY during SELECT.

I'll admit I'm less of a fan of that second option though. It seems that changing the logical
order is 1) more natural (to me at least obviously) and 2) avoids having to use ORDER BY DESC
in all your query.

bq. I think I'd prefer to move this into our "implementation extensions" section as WITH CLUSTERING
ORDERED BY (time DESC) or something similar

Why not, but I do prefer "my" notation in that it's more concise and, at least if it changes
the logical order, I guess it doesn't feel like being just an 'implementation extension'.
> Add support for ReversedType
> ----------------------------
>                 Key: CASSANDRA-4004
>                 URL:
>             Project: Cassandra
>          Issue Type: Sub-task
>          Components: API
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Trivial
>             Fix For: 1.1.1
>         Attachments: 4004.txt
> It would be nice to add a native syntax for the use of ReversedType. I'm sure there is
anything in SQL that we inspired ourselves from, so I would propose something like:
> {noformat}
> CREATE TABLE timeseries (
>   key text,
>   time uuid,
>   value text,
>   PRIMARY KEY (key, time DESC)
> )
> {noformat}
> Alternatively, the DESC could also be put after the column name definition but one argument
for putting it in the PK instead is that this only apply to keys.

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