You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Antonio Serrano <as...@aserrano.com> on 2010/11/17 13:04:21 UTC

Strange values returned

Hi from Spain:

I'm just doing some samples and I'm obtaining long values instead of the
correct value

This tests were done in an ubuntu server 10.10 (x86_64) with cassandra 0.7
beta 3 and oracle java 1.6.0_22

What am I doing wrong?

Thanks.

[default@MyKeyspace] aserrano@ubuntu:/opt/
cassandra$ bin/cassandra-cli
Welcome to cassandra CLI.

Type 'help' or '?' for help. Type 'quit' or 'exit' to quit.
[default@unknown] connect localhost/9160
Connected to: "Test Cluster" on localhost/9160
[default@unknown] create keyspace MyKeyspace with replication_factor=1
5c7ea1e9-f237-11df-9937-e700f669bcfc
[default@unknown] use MyKeyspace
Authenticated to keyspace: MyKeyspace
[default@MyKeyspace] create column family User
728b9f1a-f237-11df-9937-e700f669bcfc
[default@MyKeyspace] describe keyspace MyKeyspace
Keyspace: MyKeyspace:
  Replication Factor: 1
  Column Families:
    ColumnFamily: User
      Columns sorted by: org.apache.cassandra.db.marshal.BytesType
      Row cache size / save period: 0.0/0
      Key cache size / save period: 200000.0/3600
      Memtable thresholds: 0.0703125/15/60
      GC grace seconds: 864000
      Compaction min/max thresholds: 4/32
[default@MyKeyspace] set User['aserrano']['name']='Antonio Serrano'
Value inserted.
[default@MyKeyspace] set User['aserrano']['email']='prueba@localhost'
Value inserted.
[default@MyKeyspace] get User['aserrano']
=> (column=6e616d65, value=416e746f6e696f2053657272616e6f,
timestamp=1289990636020000)
=> (column=656d61696c, value=707275656261406c6f63616c686f7374,
timestamp=1289990653416000)
Returned 2 results.

Re: Strange values returned

Posted by Jonathan Ellis <jb...@gmail.com>.
You haven't told Cassandra to treat your columns as anything but
bytes.  If you want it to know that email is a string, you need to
write

create column family User with comparator=UTF8Type and
column_metadata=[{column_name:email, validation_class:UTF8Type}]

On Wed, Nov 17, 2010 at 6:04 AM, Antonio Serrano <as...@aserrano.com> wrote:
> Hi from Spain:
>
> I'm just doing some samples and I'm obtaining long values instead of the
> correct value
>
> This tests were done in an ubuntu server 10.10 (x86_64) with cassandra 0.7
> beta 3 and oracle java 1.6.0_22
>
> What am I doing wrong?
>
> Thanks.
>
> [default@MyKeyspace] aserrano@ubuntu:/opt/
> cassandra$ bin/cassandra-cli
> Welcome to cassandra CLI.
>
> Type 'help' or '?' for help. Type 'quit' or 'exit' to quit.
> [default@unknown] connect localhost/9160
> Connected to: "Test Cluster" on localhost/9160
> [default@unknown] create keyspace MyKeyspace with replication_factor=1
> 5c7ea1e9-f237-11df-9937-e700f669bcfc
> [default@unknown] use MyKeyspace
> Authenticated to keyspace: MyKeyspace
> [default@MyKeyspace] create column family User
> 728b9f1a-f237-11df-9937-e700f669bcfc
> [default@MyKeyspace] describe keyspace MyKeyspace
> Keyspace: MyKeyspace:
>   Replication Factor: 1
>   Column Families:
>     ColumnFamily: User
>       Columns sorted by: org.apache.cassandra.db.marshal.BytesType
>       Row cache size / save period: 0.0/0
>       Key cache size / save period: 200000.0/3600
>       Memtable thresholds: 0.0703125/15/60
>       GC grace seconds: 864000
>       Compaction min/max thresholds: 4/32
> [default@MyKeyspace] set User['aserrano']['name']='Antonio Serrano'
> Value inserted.
> [default@MyKeyspace] set User['aserrano']['email']='prueba@localhost'
> Value inserted.
> [default@MyKeyspace] get User['aserrano']
> => (column=6e616d65, value=416e746f6e696f2053657272616e6f,
> timestamp=1289990636020000)
> => (column=656d61696c, value=707275656261406c6f63616c686f7374,
> timestamp=1289990653416000)
> Returned 2 results.



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com