You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Maxim Potekhin <po...@bnl.gov> on 2012/04/08 02:48:26 UTC

a very simple indexing question (strange thing seen in CLI)

Greetings,
Cassandra 0.8.8 is used.

I'm trying to create an additional CF which is trivial in all respects. 
Just ascii columns and a few indexes.

This is how I add an index:
update column family files with column_metadata = [{column_name : '1',  
validation_class : AsciiType, index_type : 0, index_name : 'pandaid'}];

When I do "show keyspaces", I see this:

     ColumnFamily: files
       Key Validation Class: org.apache.cassandra.db.marshal.BytesType
       Default column value validator: 
org.apache.cassandra.db.marshal.BytesType
       Columns sorted by: org.apache.cassandra.db.marshal.BytesType
       Row cache size / save period in seconds: 0.0/0
       Row Cache Provider: 
org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider
       Key cache size / save period in seconds: 200000.0/14400
       Memtable thresholds: 2.2828125/1440/487 (millions of ops/minutes/MB)
       GC grace seconds: 864000
       Compaction min/max thresholds: 4/32
       Read repair chance: 1.0
       Replicate on write: true
       Built indexes: [files.pandaid]
       Column Metadata:
         Column Name:  (01)
           Validation Class: org.apache.cassandra.db.marshal.AsciiType
           Index Name: pandaid
           Index Type: KEYS

First off, why do I see (01)? I have a similar CF where I just see "1". 
Before inserting the data, I did "assume" to ascii
on the keys, comparator and validator. The index has been built. When I 
try to access the data via the index, I get this:
[default@PANDA] get files where '1'='1460103677';
InvalidRequestException(why:No indexed columns present in index clause 
with operator EQ)


What is happening? Sorry for the admittedly trivial question, obviously 
I'm stuck with something quite simple
which I managed to do with zero effort in the past.

Maxim




Re: a very simple indexing question (strange thing seen in CLI)

Posted by aaron morton <aa...@thelastpickle.com>.
> First off, why do I see (01)? I have a similar CF where I just see "1".
The CF uses BytesType as the comparator, which displays values as Hex. 01 is the hex representation of 1.

> Before inserting the data, I did "assume" to ascii
> on the keys, comparator and validator.
This is a feature of cassandra-cli and does not change the server side schema. 

> What is happening? Sorry for the admittedly trivial question, obviously I'm stuck with something quite simple
> which I managed to do with zero effort in the past.
This works for me:

[default@dev] get files where '1'='1460103677';

0 Row Returned.

This fails.

[default@dev] assume files comparator as ascii;
Assumption for column family 'files' added successfully.
[default@dev] get files where '01'='1460103677';
No indexed columns present in index clause with operator EQ
[default@dev] 

Do you still have the assume present ? 

Cheers


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

On 8/04/2012, at 12:48 PM, Maxim Potekhin wrote:

> Greetings,
> Cassandra 0.8.8 is used.
> 
> I'm trying to create an additional CF which is trivial in all respects. Just ascii columns and a few indexes.
> 
> This is how I add an index:
> update column family files with column_metadata = [{column_name : '1',  validation_class : AsciiType, index_type : 0, index_name : 'pandaid'}];
> 
> When I do "show keyspaces", I see this:
> 
>    ColumnFamily: files
>      Key Validation Class: org.apache.cassandra.db.marshal.BytesType
>      Default column value validator: org.apache.cassandra.db.marshal.BytesType
>      Columns sorted by: org.apache.cassandra.db.marshal.BytesType
>      Row cache size / save period in seconds: 0.0/0
>      Row Cache Provider: org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider
>      Key cache size / save period in seconds: 200000.0/14400
>      Memtable thresholds: 2.2828125/1440/487 (millions of ops/minutes/MB)
>      GC grace seconds: 864000
>      Compaction min/max thresholds: 4/32
>      Read repair chance: 1.0
>      Replicate on write: true
>      Built indexes: [files.pandaid]
>      Column Metadata:
>        Column Name:  (01)
>          Validation Class: org.apache.cassandra.db.marshal.AsciiType
>          Index Name: pandaid
>          Index Type: KEYS
> 
> First off, why do I see (01)? I have a similar CF where I just see "1". Before inserting the data, I did "assume" to ascii
> on the keys, comparator and validator. The index has been built. When I try to access the data via the index, I get this:
> [default@PANDA] get files where '1'='1460103677';
> InvalidRequestException(why:No indexed columns present in index clause with operator EQ)
> 
> 
> What is happening? Sorry for the admittedly trivial question, obviously I'm stuck with something quite simple
> which I managed to do with zero effort in the past.
> 
> Maxim
> 
> 
>