cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Petrov (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-7017) allow per-partition LIMIT clause in cql
Date Tue, 05 Apr 2016 15:55:25 GMT


Alex Petrov commented on CASSANDRA-7017:

Patch is now attached. I've reused the same mechanism that is used for {{DISTINCT}} queries,
and it turned out to be even simpler (I hope I haven't missed anything). {{Pager}} / {{execute}}
are intact, as per partition limit is handled through {{ReadQuery}} and {{DataLimits}} ({{CqlDataLimits}}).

{{DISTINCT}} queries simply override per partition limits.

Tests are added for ordering, filtering, static columns, IN queries, combined per partition
and "global" limits. Since partitions may come out of order, in order to verify not only amounts
of returned results but also results themselves, I had to group them together and just test
the data properties.


> allow per-partition LIMIT clause in cql
> ---------------------------------------
>                 Key: CASSANDRA-7017
>                 URL:
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Jonathan Halliday
>            Assignee: Alex Petrov
>              Labels: cql
>             Fix For: 3.x
>         Attachments: 0001-CASSANDRA-7017.patch
> somewhat related to static columns (#6561) and slicing (#4851), it is desirable to apply
a LIMIT on a per-partition rather than per-query basis, such as to retrieve the top (most
recent, etc) N clustered values for each partition key, e.g.
> -- for each league, keep a ranked list of users
> create table scores (league text, score int, player text, primary key(league, score,
player) );
> -- get the top 3 teams in each league:
> select * from scores staticlimit 3;
> this currently requires issuing one query per partition key, which is tedious if all
the key partition key values are known and impossible if they aren't.

This message was sent by Atlassian JIRA

View raw message