That's likely because there wasn't previously a validation class for the
"age" column before you added that index.  In other words, the CLI doesn't
display values in a UTF8 format until you tell it to so I think the value
"8" is correct and you could check that by running the CLI command "assume
User validator as utf8" and querying the CF User (without the index) again
to see if you get "8" as the value for the age column.

On Sun, Jan 22, 2012 at 1:01 AM, Ruben Rubio Rey <tk42...@gmail.com> wrote:

> 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
>

Reply via email to