You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jonathan Ellis (JIRA)" <ji...@apache.org> on 2009/04/28 19:44:30 UTC

[jira] Updated: (CASSANDRA-71) Range query support

     [ https://issues.apache.org/jira/browse/CASSANDRA-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis updated CASSANDRA-71:
------------------------------------

    Attachment: 71.patch

Add range query support, which requires using an OrderPreservingPartitioner.  (Keys are returned in the order defined by the partitioner collation.)  The fundamental approach (in table.getKeyRange) is simple: create a CollatedIterator [See http://commons.apache.org/collections/api/org/apache/commons/collections/IteratorUtils.html#collatedIterator(java.util.Comparator,%20java.util.Collection)] that will return unique keys from different sources, each of which is already sorted.  Then we just need Iterators for different key sources.  

For SSTables, this means adding seekTo and an Iterator interface to FileStruct.  For Memtable, this means adding a DestructivePQIterator since unlike SSTable keys those are not inherently ordered already.  This means that we only do M log N work sorting the memtable keys where M is the number of keys we actually read, and N is the total number of keys, where a naive sort-everything-first iterator would be N log N.

This does not implement ranges spanning multiple nodes.  I will implement that for another ticket.

> Range query support
> -------------------
>
>                 Key: CASSANDRA-71
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-71
>             Project: Cassandra
>          Issue Type: New Feature
>            Reporter: Jonathan Ellis
>            Assignee: Jonathan Ellis
>             Fix For: 0.3
>
>         Attachments: 71.patch
>
>
> Scan for keys by range (between X and Y) or prefix (starting with P).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.