incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Sanford <psanf...@nearbuysystems.com>
Subject Re: cassandra twitter ruby client
Date Mon, 27 Aug 2012 22:34:31 GMT
That library requires you to serialize and deserialize the data
yourself. So to insert a ruby Float you would

  value = 28.21
  [value].pack('G')
  @client.insert(:somecf, 'key', {'floatval' => [value].pack('G')})

and to read it back out:

  value = @client.get(:somecf, 'key', ['floatval']).unpack('G')[0]

Note that the cassandra-cql library will do (most) typecasts for you.

-psanford

On Mon, Aug 27, 2012 at 2:49 PM, Yuhan Zhang <yzhang@onescreen.com> wrote:
> Hi all,
>
> I'm playing with cassandra's ruby client written by twitter,  trying to
> perform a simple get.
>
> but looks like it assumed the value types to be uft8 string. however, my
> values are in double (keyed and column names are utf8types).
> The values that I got are like:
> {"Top":"?\ufffd\ufffd\ufffd\u0000\u0000\u0000\u0000", ... }
>
> how do I pass double serializer to the api client?
>
>
> Thank you.
>
> Yuhan

Mime
View raw message