cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruben Rubio Rey <tk42...@gmail.com>
Subject Playing around with Cassandra ... how did the value changed?
Date Sun, 22 Jan 2012 08:01:03 GMT
Hi Everyone,

I am getting started with Cassandra and I decided to play around with the
Example at 'getting started'.

The thing is that something happened that it does not make sense to me, it
looks like the value one value just changed from 38 to 8 after adding an
index.


[default@Twissandra] get User['jsmith'];
=> (*column=age, value=38*, timestamp=1327217985629000)
=> (column=first, value=74776974746572, timestamp=1327217843318000)
=> (column=last, value=536d697468, timestamp=1327217752256000)
=> (column=twitter, value=twitter, timestamp=1327217988179000)
Returned 4 results.
Elapsed time: 39 msec(s).

You can see that the column age the value is 38. I tried to test a search:

[default@Twissandra] get User where age = '38';
No indexed columns present in index clause with operator EQ

Ok, I had a missing index. I tried to add it

[default@Twissandra] update column family User with column_metadata =
[{column_name: age, validation_class: UTF8Type, index_type: KEYS}];
b59a9710-44cc-11e1-0000-242d50cf1fbf
Waiting for schema agreement...
... schemas agree across the cluster

I try again to search by the age ...
[default@Twissandra] get User where age = '38';
0 Row Returned.
Elapsed time: 23 msec(s).

I check the record to double check the age
[default@Twissandra] get User['jsmith'];
=> (*column=age, value=8*, timestamp=1327217985629000)
=> (column=first, value=74776974746572, timestamp=1327217843318000)
=> (column=last, value=536d697468, timestamp=1327217752256000)
=> (column=twitter, value=74776974746572, timestamp=1327217988179000)
Returned 4 results.
Elapsed time: 11 msec(s).

It changed !

[default@Twissandra] get User where age = '8';
-------------------
RowKey: jsmith
=> (*column=age, value=8*, timestamp=1327217985629000)
=> (column=first, value=74776974746572, timestamp=1327217843318000)
=> (column=last, value=536d697468, timestamp=1327217752256000)
=> (column=twitter, value=74776974746572, timestamp=1327217988179000)
1 Row Returned.
Elapsed time: 38 msec(s).

As I said I am quite new in Cassandra, so I am aware that I might be doing
something wrong. Any clue why the age changed from 38 to 8 ?


Some more information:

cassandra 1.0.7

$ java -showversion
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

Regards,
Ruben

Mime
View raw message