You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Sasha Dolgy <sd...@gmail.com> on 2011/10/11 22:48:56 UTC
Operator on secondary indexes in 0.8.x (GTE/LTE)
I was trying to get a range of rows based on a secondary_index that was
defined. Any rows where age was greater than or equal to ... it didn't
work. Is this a continued limitation? Did a quick look in JIRA, couldn't
find anything.
The output from "help get;" on the cli contains the following, which led me
to believe it was a limitation on Cassandra 0.7.x and not on 0.8.x ...
get <cf> where <col> <operator> <value> [
and <col> <operator> <value> and ...] [limit <limit>];
get <cf> where <col> <operator> <function>(<value>) [
and <col> <operator> <function> and ...] [limit <limit>];
- operator: Operator to test the column value with. Supported operators are
=, >, >=, <, <= .
In Cassandra 0.7 at least one = operator must be present.
[default@sdo] get user where age >= 18;
No indexed columns present in index clause with operator EQ
[default@sdo] get user where gender = 1 and age >= 18
(returns results)
Tested this behavior on 0.8.2, 0.8.6 and now 0.8.7 ...
create column family user
with column_type = 'Standard'
and comparator = 'UTF8Type'
and default_validation_class = 'BytesType'
and key_validation_class = 'BytesType'
and memtable_operations = 0.24843749999999998
and memtable_throughput = 53
and memtable_flush_after = 1440
and rows_cached = 0.0
and row_cache_save_period = 0
and keys_cached = 200000.0
and key_cache_save_period = 14400
and read_repair_chance = 1.0
and gc_grace = 864000
and min_compaction_threshold = 4
and max_compaction_threshold = 32
and replicate_on_write = true
and row_cache_provider = 'ConcurrentLinkedHashCacheProvider'
and column_metadata = [
{column_name : 'gender',
validation_class : LongType,
index_name : 'user_gender_idx',
index_type : 0},
{column_name : 'year',
validation_class : LongType,
index_name : 'user_year_idx',
index_type : 0}];
--
Sasha Dolgy
sasha.dolgy@gmail.com
Re: Operator on secondary indexes in 0.8.x (GTE/LTE)
Posted by Jonathan Ellis <jb...@gmail.com>.
simple, elegant, and less performant than just doing a range scan
without the index. :)
On Tue, Oct 11, 2011 at 4:06 PM, Sasha Dolgy <sd...@gmail.com> wrote:
> ah, hadn't even thought of that. simple. elegant.
> cheers.
>
> On Tue, Oct 11, 2011 at 11:01 PM, Jake Luciani <ja...@gmail.com> wrote:
>>
>> This hasn't changed in AFAIK, In Brisk we had the same problem in CFS so
>> we created a sentinel value that all rows shared then it works.
>> CASSANDRA-2915 should fix it.
>> On Tue, Oct 11, 2011 at 4:48 PM, Sasha Dolgy <sd...@gmail.com> wrote:
>>>
>>> I was trying to get a range of rows based on a secondary_index that was
>>> defined. Any rows where age was greater than or equal to ... it didn't
>>> work. Is this a continued limitation? Did a quick look in JIRA, couldn't
>>> find anything.
>>> The output from "help get;" on the cli contains the following, which led
>>> me to believe it was a limitation on Cassandra 0.7.x and not on 0.8.x ...
>>> get <cf> where <col> <operator> <value> [
>>> and <col> <operator> <value> and ...] [limit <limit>];
>>> get <cf> where <col> <operator> <function>(<value>) [
>>> and <col> <operator> <function> and ...] [limit <limit>];
>>> - operator: Operator to test the column value with. Supported operators
>>> are
>>> =, >, >=, <, <= .
>>> In Cassandra 0.7 at least one = operator must be present.
>>> [default@sdo] get user where age >= 18;
>>> No indexed columns present in index clause with operator EQ
>>> [default@sdo] get user where gender = 1 and age >= 18
>>> (returns results)
>>> Tested this behavior on 0.8.2, 0.8.6 and now 0.8.7 ...
>>> create column family user
>>> with column_type = 'Standard'
>>> and comparator = 'UTF8Type'
>>> and default_validation_class = 'BytesType'
>>> and key_validation_class = 'BytesType'
>>> and memtable_operations = 0.24843749999999998
>>> and memtable_throughput = 53
>>> and memtable_flush_after = 1440
>>> and rows_cached = 0.0
>>> and row_cache_save_period = 0
>>> and keys_cached = 200000.0
>>> and key_cache_save_period = 14400
>>> and read_repair_chance = 1.0
>>> and gc_grace = 864000
>>> and min_compaction_threshold = 4
>>> and max_compaction_threshold = 32
>>> and replicate_on_write = true
>>> and row_cache_provider = 'ConcurrentLinkedHashCacheProvider'
>>> and column_metadata = [
>>> {column_name : 'gender',
>>> validation_class : LongType,
>>> index_name : 'user_gender_idx',
>>> index_type : 0},
>>> {column_name : 'year',
>>> validation_class : LongType,
>>> index_name : 'user_year_idx',
>>> index_type : 0}];
>>>
>>>
>>> --
>>> Sasha Dolgy
>>> sasha.dolgy@gmail.com
>>
>>
>>
>> --
>> http://twitter.com/tjake
>
>
>
> --
> Sasha Dolgy
> sasha.dolgy@gmail.com
>
--
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com
Re: Operator on secondary indexes in 0.8.x (GTE/LTE)
Posted by Sasha Dolgy <sd...@gmail.com>.
ah, hadn't even thought of that. simple. elegant.
cheers.
On Tue, Oct 11, 2011 at 11:01 PM, Jake Luciani <ja...@gmail.com> wrote:
> This hasn't changed in AFAIK, In Brisk we had the same problem in CFS so
> we created a sentinel value that all rows shared then it works.
> CASSANDRA-2915 should fix it.
>
> On Tue, Oct 11, 2011 at 4:48 PM, Sasha Dolgy <sd...@gmail.com> wrote:
>
>> I was trying to get a range of rows based on a secondary_index that was
>> defined. Any rows where age was greater than or equal to ... it didn't
>> work. Is this a continued limitation? Did a quick look in JIRA, couldn't
>> find anything.
>>
>> The output from "help get;" on the cli contains the following, which led
>> me to believe it was a limitation on Cassandra 0.7.x and not on 0.8.x ...
>>
>> get <cf> where <col> <operator> <value> [
>> and <col> <operator> <value> and ...] [limit <limit>];
>> get <cf> where <col> <operator> <function>(<value>) [
>> and <col> <operator> <function> and ...] [limit <limit>];
>>
>> - operator: Operator to test the column value with. Supported operators
>> are
>> =, >, >=, <, <= .
>>
>> In Cassandra 0.7 at least one = operator must be present.
>>
>> [default@sdo] get user where age >= 18;
>> No indexed columns present in index clause with operator EQ
>> [default@sdo] get user where gender = 1 and age >= 18
>> (returns results)
>>
>> Tested this behavior on 0.8.2, 0.8.6 and now 0.8.7 ...
>>
>> create column family user
>> with column_type = 'Standard'
>> and comparator = 'UTF8Type'
>> and default_validation_class = 'BytesType'
>> and key_validation_class = 'BytesType'
>> and memtable_operations = 0.24843749999999998
>> and memtable_throughput = 53
>> and memtable_flush_after = 1440
>> and rows_cached = 0.0
>> and row_cache_save_period = 0
>> and keys_cached = 200000.0
>> and key_cache_save_period = 14400
>> and read_repair_chance = 1.0
>> and gc_grace = 864000
>> and min_compaction_threshold = 4
>> and max_compaction_threshold = 32
>> and replicate_on_write = true
>> and row_cache_provider = 'ConcurrentLinkedHashCacheProvider'
>> and column_metadata = [
>> {column_name : 'gender',
>> validation_class : LongType,
>> index_name : 'user_gender_idx',
>> index_type : 0},
>> {column_name : 'year',
>> validation_class : LongType,
>> index_name : 'user_year_idx',
>> index_type : 0}];
>>
>>
>>
>> --
>> Sasha Dolgy
>> sasha.dolgy@gmail.com
>>
>
>
>
> --
> http://twitter.com/tjake
>
--
Sasha Dolgy
sasha.dolgy@gmail.com
Re: Operator on secondary indexes in 0.8.x (GTE/LTE)
Posted by Jake Luciani <ja...@gmail.com>.
This hasn't changed in AFAIK, In Brisk we had the same problem in CFS so we
created a sentinel value that all rows shared then it works. CASSANDRA-2915
should fix it.
On Tue, Oct 11, 2011 at 4:48 PM, Sasha Dolgy <sd...@gmail.com> wrote:
> I was trying to get a range of rows based on a secondary_index that was
> defined. Any rows where age was greater than or equal to ... it didn't
> work. Is this a continued limitation? Did a quick look in JIRA, couldn't
> find anything.
>
> The output from "help get;" on the cli contains the following, which led me
> to believe it was a limitation on Cassandra 0.7.x and not on 0.8.x ...
>
> get <cf> where <col> <operator> <value> [
> and <col> <operator> <value> and ...] [limit <limit>];
> get <cf> where <col> <operator> <function>(<value>) [
> and <col> <operator> <function> and ...] [limit <limit>];
>
> - operator: Operator to test the column value with. Supported operators are
> =, >, >=, <, <= .
>
> In Cassandra 0.7 at least one = operator must be present.
>
> [default@sdo] get user where age >= 18;
> No indexed columns present in index clause with operator EQ
> [default@sdo] get user where gender = 1 and age >= 18
> (returns results)
>
> Tested this behavior on 0.8.2, 0.8.6 and now 0.8.7 ...
>
> create column family user
> with column_type = 'Standard'
> and comparator = 'UTF8Type'
> and default_validation_class = 'BytesType'
> and key_validation_class = 'BytesType'
> and memtable_operations = 0.24843749999999998
> and memtable_throughput = 53
> and memtable_flush_after = 1440
> and rows_cached = 0.0
> and row_cache_save_period = 0
> and keys_cached = 200000.0
> and key_cache_save_period = 14400
> and read_repair_chance = 1.0
> and gc_grace = 864000
> and min_compaction_threshold = 4
> and max_compaction_threshold = 32
> and replicate_on_write = true
> and row_cache_provider = 'ConcurrentLinkedHashCacheProvider'
> and column_metadata = [
> {column_name : 'gender',
> validation_class : LongType,
> index_name : 'user_gender_idx',
> index_type : 0},
> {column_name : 'year',
> validation_class : LongType,
> index_name : 'user_year_idx',
> index_type : 0}];
>
>
>
> --
> Sasha Dolgy
> sasha.dolgy@gmail.com
>
--
http://twitter.com/tjake