cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Speirs <bill.spe...@gmail.com>
Subject Re: Probelms with Set on Byte type New Installation
Date Wed, 26 Jan 2011 21:08:59 GMT
Why would you expect strings? You stated that your comparator is
BytesType. If you set the default_validation_class then you can
specify what types the values should be returned as:

[default@Devel] create column family david with comparator=BytesType
and default_validation_class=UTF8Type;
2dabf0fb-298f-11e0-b177-e700f669bcfc
[default@Devel] set david['david']['test'] = 'test';
Value inserted.
[default@Devel] get david['david'];
=> (column=74657374, value=test, timestamp=1296075624670000)
Returned 1 results.

Now the column name is returned as the ASCII characters for 'test' and
the value is returned as a string because of the
default_validation_class. That seems to make sense to me. If in the
next column you want to sore a number you must store it as such and
return it as such:

[default@Devel] set david['david']['id'] = 37;
Value inserted.
[default@Devel] get david['david']['id'] as integer;
=> (column=6964, value=13111, timestamp=1296075820330000)

Didn't work because it was inserted as a string not a number/integer.
However, if you specify it's a number on the way it, it will return
properly:

[default@Devel] set david['david']['id'] = integer(37);
Value inserted.
[default@Devel] get david['david']['id'] as integer;
=> (column=6964, value=37, timestamp=1296075929082000)

Hope that helps... again, I'm new to this so maybe I'm not
understanding your question.

Bill-

On Wed, Jan 26, 2011 at 3:50 PM, David Quattlebaum
<dquattle@medprocure.com> wrote:
> Nope, I should be getting back the String values that were inserted:
>
> [default@TestKeyspace] get custparent['David'];
> => (column=4164647265737331, value=333038204279205061737320313233,
> timestamp=1296071732281000)
> => (column=43697479, value=53656e656361, timestamp=1296071747310000)
> => (column=4e616d65, value=546f6d7320466163696c697479,
> timestamp=1296071708189000)
> => (column=506f7374616c436f6465, value=3239363738,
> timestamp=1296071774549000)
> => (column=537461746550726f76, value=5343, timestamp=1296071760213000)
> Returned 5 results.
>
> Values should be Name and Address Values.
>
> -David Q
>
> -----Original Message-----
> From: Bill Speirs [mailto:bill.speirs@gmail.com]
> Sent: Wednesday, January 26, 2011 3:45 PM
> To: user@cassandra.apache.org
> Subject: RE: Probelms with Set on Byte type New Installation
>
> I'm very (2 days) new to Cassandra, but what does the output look like?
>
> Total shot in the dark, if the number is less than 256 would it not
> look the same as bytes or a number?
>
> Hope that in some way helps...
>
> Bill-
>
> From: David Quattlebaum [mailto:dquattle@medprocure.com]
> Sent: Wednesday, January 26, 2011 3:25 PM
> To: user@cassandra.apache.org
> Subject: Probelms with Set on Byte type New Installation
>
> I have set up a new installation of Cassandra, and have it running
> with no problems (0.7.0)
>
> Using CLI I added a new keyspace, and column family.
>
> When I set a value for a column I get "Value Inserted"
>
> However, when I get the column value it is a number, even though the
> Column Family is of Bytes Type:
> Keyspace: XXXXXXXXXXX:
>  Replication Strategy: org.apache.cassandra.locator.SimpleStrategy
>    Replication Factor: 1
>  Column Families:
>    ColumnFamily: YYYYYYYYY
>      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
>      Read repair chance: 1.0
>      Built indexes: []
>
>
> Anyone else had this happen?
> Did I just miss something stupid?
> I have not had any issues with earlier versions of Cassandra.
>
>
> David Q
>
>
> David Quattlebaum
> MedProcure, LLC
> www.medprocure.com
> (864)482-2018 - Support
> (864)482-2019 - Direct
>

Mime
View raw message