cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Morton <aa...@thelastpickle.com>
Subject Re: Multiple indexes - how does Cassandra handle these internally?
Date Mon, 24 Jan 2011 20:53:05 GMT
Timo, 
Below is a test I did via the CLI, it worked as expected for me If you're still experiencing
the problem could you try to repro it like this ?

Paste this into the CLI to setup the schema and data 


create keyspace index_test 
    with replication_factor = 1;

use index_test;

create column family Indexed
    with comparator = AsciiType
    and column_metadata = [
    {
        column_name : col1,
        validation_class : AsciiType,
        index_name : col1_idx,
        index_type : 0}, 
    {
        column_name : col2,
        validation_class : AsciiType,
        index_name : col2_idx,
        index_type : 0},
    {
        column_name : col3,
        validation_class : IntegerType,
        index_name : col3_idx,
        index_type : 0},
    ];

set Indexed['key1']['col1'] = 'value1';
set Indexed['key1']['col2'] = 'value2';
set Indexed['key1']['col3'] = '3';
set Indexed['key2']['col1'] = 'value1';
set Indexed['key2']['col2'] = 'value2';
set Indexed['key2']['col3'] = '3';
set Indexed['key3']['col1'] = 'value1';
set Indexed['key3']['col2'] = 'foo';
set Indexed['key3']['col3'] = '0';
set Indexed['key4']['col1'] = 'foo';
set Indexed['key4']['col2'] = 'value2';
set Indexed['key4']['col3'] = '0';
set Indexed['key5']['col1'] = 'foo';
set Indexed['key5']['col2'] = 'foo';
set Indexed['key5']['col3'] = '3';

================

Then I ran these...

[default@index_test] get Indexed where col1='value1' and col2='value2';
-------------------
RowKey: key1
=> (column=col1, value=value1, timestamp=1295901869013000)
=> (column=col2, value=value2, timestamp=1295901869017000)
=> (column=col3, value=3, timestamp=1295901869038000)
-------------------
RowKey: key2
=> (column=col1, value=value1, timestamp=1295901869044000)
=> (column=col2, value=value2, timestamp=1295901869047000)
=> (column=col3, value=3, timestamp=1295901870574000)

2 Rows Returned.

[default@index_test] get Indexed where col2='value2' and col1='value1';
-------------------
RowKey: key1
=> (column=col1, value=value1, timestamp=1295901869013000)
=> (column=col2, value=value2, timestamp=1295901869017000)
=> (column=col3, value=3, timestamp=1295901869038000)
-------------------
RowKey: key2
=> (column=col1, value=value1, timestamp=1295901869044000)
=> (column=col2, value=value2, timestamp=1295901869047000)
=> (column=col3, value=3, timestamp=1295901870574000)

2 Rows Returned.

[default@index_test] get Indexed where col1='value1' and col3='3';
-------------------
RowKey: key1
=> (column=col1, value=value1, timestamp=1295901869013000)
=> (column=col2, value=value2, timestamp=1295901869017000)
=> (column=col3, value=3, timestamp=1295901869038000)
-------------------
RowKey: key2
=> (column=col1, value=value1, timestamp=1295901869044000)
=> (column=col2, value=value2, timestamp=1295901869047000)
=> (column=col3, value=3, timestamp=1295901870574000)

2 Rows Returned.

[default@index_test] get Indexed where col3='3' and col1='value1';
-------------------
RowKey: key1
=> (column=col1, value=value1, timestamp=1295901869013000)
=> (column=col2, value=value2, timestamp=1295901869017000)
=> (column=col3, value=3, timestamp=1295901869038000)
-------------------
RowKey: key2
=> (column=col1, value=value1, timestamp=1295901869044000)
=> (column=col2, value=value2, timestamp=1295901869047000)
=> (column=col3, value=3, timestamp=1295901870574000)

2 Rows Returned.


Cheers
Aaron

On 22 Jan, 2011,at 04:56 AM, Timo Nentwig <timo.nentwig@toptarif.de> wrote:

On Jan 21, 2011, at 16:46, Maxim Potekhin wrote:

> But Timo, this is even more mysterious! If both conditions are met, at least
> something must be returned in the second query. Have you tried this in CLI?
> That would allow you to at least alleviate client concerns.


I did this on the CLI only so far. So value comparison on the index seems to be done differently
than in the nested loop...or something. Don't know, don't know the code base well enough to
debug this down to the very bottom either. But it's actually only a CF with 2 cols (AsciiType
and IntegerType) and a command in the CLI so not too time-consuming to reproduce.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
    • Unnamed multipart/related (inline, None, 0 bytes)
View raw message