You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Vivek Mishra <mi...@gmail.com> on 2012/03/13 13:12:12 UTC

Row iteration over indexed clause

Hi,
Is it possible to iterate and fetch in chunks using thrift API by querying
using "secondary indexes"?

-Vivek

Re: Row iteration over indexed clause

Posted by Tyler Hobbs <ty...@datastax.com>.
Are you writing a new client for a language that doesn't have good
drivers?  If not, most of the existing clients already break up the query
into chunks, I think.

The pycassa implementation of this might be a useful reference:
https://github.com/pycassa/pycassa/blob/master/pycassa/columnfamily.py#L561

On Wed, Mar 14, 2012 at 2:35 AM, aaron morton <aa...@thelastpickle.com>wrote:

> If you want 100 results per call, ask for 101. Use the first 100, when you
> get to the 101'st do not examine it's data. Instead use it's key as the
> start to get the next 101.
>
> Cheers
>
> -----------------
> Aaron Morton
> Freelance Developer
> @aaronmorton
> http://www.thelastpickle.com
>
> On 14/03/2012, at 2:03 AM, Vivek Mishra wrote:
>
> Thanks.
>
> *Attribute*
> *Type*
> *Default*
> *Required*
> *Description*
> expressions
> list<IndexExpression>
> n/a
> Y
> The list of IndexExpression objects which must contain one EQ
> IndexOperator among the expressions
>  start_key
> binary
> n/a
> Y
> Start the index query at the specified key - can be set to '', i.e., an
> empty byte array, to start with the first key
>  count
> integer
> 100
> Y
> The number of results to which the index query will be constrained
>
>
>
> How do i iterate using it? How do i ensure that it should not return me
> previous results(without i need to keep something in-memory)?
>
> This is the method i am looking into:
>
> get_indexed_slices(ColumnParent column_parent, IndexClause index_clause,
> SlicePredicate column_predicate, ConsistencyLevel consistency_level)
>
> It does not have anything like count.
>
>
> Thanks,
> Vivek
>
> On Tue, Mar 13, 2012 at 6:24 PM, Shimi Kiviti <sh...@gmail.com> wrote:
>
>> Yes. use get_indexed_slices (http://wiki.apache.org/cassandra/API)
>> On Tue, Mar 13, 2012 at 2:12 PM, Vivek Mishra <mi...@gmail.com>wrote:
>>
>>> Hi,
>>> Is it possible to iterate and fetch in chunks using thrift API by
>>> querying using "secondary indexes"?
>>>
>>> -Vivek
>>>
>>
>>
>
>


-- 
Tyler Hobbs
DataStax <http://datastax.com/>

Re: Row iteration over indexed clause

Posted by aaron morton <aa...@thelastpickle.com>.
If you want 100 results per call, ask for 101. Use the first 100, when you get to the 101'st do not examine it's data. Instead use it's key as the start to get the next 101.

Cheers

-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com

On 14/03/2012, at 2:03 AM, Vivek Mishra wrote:

> Thanks.
> 
> Attribute
> Type
> Default
> Required
> Description
> expressions
> list<IndexExpression>
> n/a
> Y
> The list of IndexExpression objects which must contain one EQ IndexOperator among the expressions
> start_key
> binary
> n/a
> Y
> Start the index query at the specified key - can be set to '', i.e., an empty byte array, to start with the first key
> count
> integer
> 100
> Y
> The number of results to which the index query will be constrained
> 
> 
> 
> How do i iterate using it? How do i ensure that it should not return me previous results(without i need to keep something in-memory)?
> 
> This is the method i am looking into:
> 
> get_indexed_slices(ColumnParent column_parent, IndexClause index_clause, SlicePredicate column_predicate, ConsistencyLevel consistency_level)
> 
> It does not have anything like count.
> 
> 
> Thanks,
> Vivek
> 
> On Tue, Mar 13, 2012 at 6:24 PM, Shimi Kiviti <sh...@gmail.com> wrote:
> Yes.
> 
> use get_indexed_slices (http://wiki.apache.org/cassandra/API)
> 
> On Tue, Mar 13, 2012 at 2:12 PM, Vivek Mishra <mi...@gmail.com> wrote:
> Hi,
> Is it possible to iterate and fetch in chunks using thrift API by querying using "secondary indexes"?
> 
> -Vivek
> 
> 


Re: Row iteration over indexed clause

Posted by Vivek Mishra <mi...@gmail.com>.
Thanks.

*Attribute*

*Type*

*Default*

*Required*

*Description*

expressions

list<IndexExpression>

n/a

Y

The list of IndexExpression objects which must contain one EQ
IndexOperator among
the expressions

start_key

binary

n/a

Y

Start the index query at the specified key - can be set to '', i.e., an
empty byte array, to start with the first key

count

integer

100

Y

The number of results to which the index query will be constrained




How do i iterate using it? How do i ensure that it should not return me
previous results(without i need to keep something in-memory)?

This is the method i am looking into:

get_indexed_slices(ColumnParent column_parent, IndexClause index_clause,
SlicePredicate column_predicate, ConsistencyLevel consistency_level)

It does not have anything like count.


Thanks,
Vivek

On Tue, Mar 13, 2012 at 6:24 PM, Shimi Kiviti <sh...@gmail.com> wrote:

> Yes. use get_indexed_slices (http://wiki.apache.org/cassandra/API)
> On Tue, Mar 13, 2012 at 2:12 PM, Vivek Mishra <mi...@gmail.com>wrote:
>
>> Hi,
>> Is it possible to iterate and fetch in chunks using thrift API by
>> querying using "secondary indexes"?
>>
>> -Vivek
>>
>
>

Re: Row iteration over indexed clause

Posted by Shimi Kiviti <sh...@gmail.com>.
Yes.use get_indexed_slices (http://wiki.apache.org/cassandra/API)
On Tue, Mar 13, 2012 at 2:12 PM, Vivek Mishra <mi...@gmail.com> wrote:

> Hi,
> Is it possible to iterate and fetch in chunks using thrift API by querying
> using "secondary indexes"?
>
> -Vivek
>