You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by David Erickson <ha...@gmail.com> on 2010/09/09 20:08:35 UTC

IndexOperator LT/LTE/GT/GTE Implementation

Hi all,
I have been running the nightly of Cassandra and was able to get the
secondary indices working for me, and queryable with IndexOperator.EQ.
 I have an additional index that I need to use IndexOperator.LTE on
for LongType, which I tried to use but the equivalent of a
NotImplementedException was thrown for anything other than .EQ.  I
found the commit introducing this:
283e365196cdad3fb352de0b6d7a8c0ddd1d784a however what puzzles me is
the same commit claims to fix issue 1401 "allow all operators in
secondary clauses to index query"
(https://issues.apache.org/jira/browse/CASSANDRA-1401), and introduces
a test for the GTE operator.  So my question is why is the
ThriftValidator disallowing these queries?

Thanks,
David

Re: IndexOperator LT/LTE/GT/GTE Implementation

Posted by David Erickson <ha...@gmail.com>.
Jonathan,
Thanks again for the reply, good to know.  Do you have a 'best
practices' suggestion on how I could map objects (currently row per
object, column per property) while meeting the following 2
requirements:
-Able to do the range scan on an object property, a time stamp, that
is not unique, and each object's timestamp is updated every O(10)
seconds
-Able to do secondary index queries (EQ) on other object properties

Thanks!
David

On Thu, Sep 9, 2010 at 7:36 PM, Jonathan Ellis <jb...@gmail.com> wrote:
> Short version: It's dictated by indexes being CFs underneath.
>
> Your "workaround" would be substantially less efficient than not using
> an index at all and just using range scan.
>
> On Thu, Sep 9, 2010 at 9:20 PM, David Erickson <ha...@gmail.com> wrote:
>> Hi Jonathan,
>> Thanks for the reply.  Why is there a limitation of requiring an EQ?
>> In my case I am modeling my CF with one object per row, with columns
>> for object properties.  The query I'd like to issue is give me all
>> objects with timestamps earlier than a specified time.  In this query
>> there is nothing for me to set EQ on.  I could work around this by
>> creating a column for every row with a known value like 0 and include
>> that column in the index clause, but that seems silly.
>>
>> Thanks,
>> David
>>
>> On Thu, Sep 9, 2010 at 4:41 PM, Jonathan Ellis <jb...@gmail.com> wrote:
>>> as the validation error ("No indexed columns present in index clause
>>> with operator EQ") explains, you need at least one at EQ after which
>>> you can add others w/ other operators
>>>
>>> On Thu, Sep 9, 2010 at 1:08 PM, David Erickson <ha...@gmail.com> wrote:
>>>> Hi all,
>>>> I have been running the nightly of Cassandra and was able to get the
>>>> secondary indices working for me, and queryable with IndexOperator.EQ.
>>>>  I have an additional index that I need to use IndexOperator.LTE on
>>>> for LongType, which I tried to use but the equivalent of a
>>>> NotImplementedException was thrown for anything other than .EQ.  I
>>>> found the commit introducing this:
>>>> 283e365196cdad3fb352de0b6d7a8c0ddd1d784a however what puzzles me is
>>>> the same commit claims to fix issue 1401 "allow all operators in
>>>> secondary clauses to index query"
>>>> (https://issues.apache.org/jira/browse/CASSANDRA-1401), and introduces
>>>> a test for the GTE operator.  So my question is why is the
>>>> ThriftValidator disallowing these queries?
>>>>
>>>> Thanks,
>>>> David
>>>>
>>>
>>>
>>>
>>> --
>>> Jonathan Ellis
>>> Project Chair, Apache Cassandra
>>> co-founder of Riptano, the source for professional Cassandra support
>>> http://riptano.com
>>>
>>
>
>
>
> --
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of Riptano, the source for professional Cassandra support
> http://riptano.com
>

Re: IndexOperator LT/LTE/GT/GTE Implementation

Posted by Jonathan Ellis <jb...@gmail.com>.
Short version: It's dictated by indexes being CFs underneath.

Your "workaround" would be substantially less efficient than not using
an index at all and just using range scan.

On Thu, Sep 9, 2010 at 9:20 PM, David Erickson <ha...@gmail.com> wrote:
> Hi Jonathan,
> Thanks for the reply.  Why is there a limitation of requiring an EQ?
> In my case I am modeling my CF with one object per row, with columns
> for object properties.  The query I'd like to issue is give me all
> objects with timestamps earlier than a specified time.  In this query
> there is nothing for me to set EQ on.  I could work around this by
> creating a column for every row with a known value like 0 and include
> that column in the index clause, but that seems silly.
>
> Thanks,
> David
>
> On Thu, Sep 9, 2010 at 4:41 PM, Jonathan Ellis <jb...@gmail.com> wrote:
>> as the validation error ("No indexed columns present in index clause
>> with operator EQ") explains, you need at least one at EQ after which
>> you can add others w/ other operators
>>
>> On Thu, Sep 9, 2010 at 1:08 PM, David Erickson <ha...@gmail.com> wrote:
>>> Hi all,
>>> I have been running the nightly of Cassandra and was able to get the
>>> secondary indices working for me, and queryable with IndexOperator.EQ.
>>>  I have an additional index that I need to use IndexOperator.LTE on
>>> for LongType, which I tried to use but the equivalent of a
>>> NotImplementedException was thrown for anything other than .EQ.  I
>>> found the commit introducing this:
>>> 283e365196cdad3fb352de0b6d7a8c0ddd1d784a however what puzzles me is
>>> the same commit claims to fix issue 1401 "allow all operators in
>>> secondary clauses to index query"
>>> (https://issues.apache.org/jira/browse/CASSANDRA-1401), and introduces
>>> a test for the GTE operator.  So my question is why is the
>>> ThriftValidator disallowing these queries?
>>>
>>> Thanks,
>>> David
>>>
>>
>>
>>
>> --
>> Jonathan Ellis
>> Project Chair, Apache Cassandra
>> co-founder of Riptano, the source for professional Cassandra support
>> http://riptano.com
>>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com

Re: IndexOperator LT/LTE/GT/GTE Implementation

Posted by David Erickson <ha...@gmail.com>.
Hi Jonathan,
Thanks for the reply.  Why is there a limitation of requiring an EQ?
In my case I am modeling my CF with one object per row, with columns
for object properties.  The query I'd like to issue is give me all
objects with timestamps earlier than a specified time.  In this query
there is nothing for me to set EQ on.  I could work around this by
creating a column for every row with a known value like 0 and include
that column in the index clause, but that seems silly.

Thanks,
David

On Thu, Sep 9, 2010 at 4:41 PM, Jonathan Ellis <jb...@gmail.com> wrote:
> as the validation error ("No indexed columns present in index clause
> with operator EQ") explains, you need at least one at EQ after which
> you can add others w/ other operators
>
> On Thu, Sep 9, 2010 at 1:08 PM, David Erickson <ha...@gmail.com> wrote:
>> Hi all,
>> I have been running the nightly of Cassandra and was able to get the
>> secondary indices working for me, and queryable with IndexOperator.EQ.
>>  I have an additional index that I need to use IndexOperator.LTE on
>> for LongType, which I tried to use but the equivalent of a
>> NotImplementedException was thrown for anything other than .EQ.  I
>> found the commit introducing this:
>> 283e365196cdad3fb352de0b6d7a8c0ddd1d784a however what puzzles me is
>> the same commit claims to fix issue 1401 "allow all operators in
>> secondary clauses to index query"
>> (https://issues.apache.org/jira/browse/CASSANDRA-1401), and introduces
>> a test for the GTE operator.  So my question is why is the
>> ThriftValidator disallowing these queries?
>>
>> Thanks,
>> David
>>
>
>
>
> --
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of Riptano, the source for professional Cassandra support
> http://riptano.com
>

Re: IndexOperator LT/LTE/GT/GTE Implementation

Posted by Jonathan Ellis <jb...@gmail.com>.
as the validation error ("No indexed columns present in index clause
with operator EQ") explains, you need at least one at EQ after which
you can add others w/ other operators

On Thu, Sep 9, 2010 at 1:08 PM, David Erickson <ha...@gmail.com> wrote:
> Hi all,
> I have been running the nightly of Cassandra and was able to get the
> secondary indices working for me, and queryable with IndexOperator.EQ.
>  I have an additional index that I need to use IndexOperator.LTE on
> for LongType, which I tried to use but the equivalent of a
> NotImplementedException was thrown for anything other than .EQ.  I
> found the commit introducing this:
> 283e365196cdad3fb352de0b6d7a8c0ddd1d784a however what puzzles me is
> the same commit claims to fix issue 1401 "allow all operators in
> secondary clauses to index query"
> (https://issues.apache.org/jira/browse/CASSANDRA-1401), and introduces
> a test for the GTE operator.  So my question is why is the
> ThriftValidator disallowing these queries?
>
> Thanks,
> David
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com