incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nate McCall <n...@datastax.com>
Subject Re: Is there a way to read a Double value from the CLI?
Date Tue, 19 Jul 2011 17:14:39 GMT
The DoubleSerializer in Hector predates Cassandra's DoubleType and was
thus designed to stick values in a LongType or BytesType comparator.
Because of this, we are calling Double.doubleToRawLongBits and
Double.longBitsToDouble underneath, so this may not be what you
expect.

I'll add another serializer(s) for the new set of types.

Now if only we had a client mailing list to which client-impacting
changes could be sent ...  :-)

On Mon, Jul 18, 2011 at 4:50 PM, Jonathan Ellis <jbellis@gmail.com> wrote:
> org.apache.cassandra.db.marshal.DoubleType should work, then.  the
> cast shouldn't be necessary if the doubletype is actually in the
> schema either.
>
> On Mon, Jul 18, 2011 at 4:34 PM, Sameer Farooqui
> <cassandralabs@gmail.com> wrote:
>> Yup, Jonathan, I was just temporarily returning the value as LongType b/c I
>> couldn't find a DoubleType. Since LongType returned something, I know that
>> the data is there.
>>
>> Thanks for that link, Jeremy. I'm guessing DoubleType hasn't found its way
>> into the CLI yet, b/c I tried this and got an error:
>>
>> [default@DemoKS] get DemoCF[ascii('ABC_100000000020')][long(20090101000000)]
>> as DoubleType;
>> Unknown comparator 'DoubleType'. Available functions: bytes, integer, long,
>> lexicaluuid, timeuuid, utf8, ascii, countercolumn.
>>
>>
>>
>>
>> On Mon, Jul 18, 2011 at 2:28 PM, Jonathan Ellis <jbellis@gmail.com> wrote:
>>>
>>> "get X as LongType" will give you the bytes in that column value
>>> interpreted as a long.
>>>
>>> So it did exactly what you asked it to do :)
>>>
>>> On Mon, Jul 18, 2011 at 4:16 PM, Sameer Farooqui
>>> <cassandralabs@gmail.com> wrote:
>>> > I wrote some data to a standard column family (using Hector) with ASCII
>>> > row-key, Long column name and Double column value.
>>> >
>>> > The CLI doesn't seem to have a double data type to interpret the column
>>> > value for display.
>>> >
>>> > [default@DemoKS] get
>>> > DemoCF[ascii('ABC_100000000020')][long(20090101000000)]
>>> > as LongType;
>>> > => (column=0000124597556740, value=4629084924887308954,
>>> > timestamp=1310144024947000)
>>> >
>>> > But that value is not exactly correct. It should be: 29.813332976331914
>>> >
>>> >
>>> > This is how I do the read in Hector:
>>> >
>>> >         ColumnQuery<String, Long, Double> columnQuery =
>>> > HFactory.createColumnQuery(keyspace, ss, ls, ds);
>>> >
>>> >
>>> >
>>> > columnQuery.setColumnFamily("DemoCF").setKey("ABC_100000000020").setName(20090101000000L);
>>> >
>>> >         QueryResult<HColumn<Long, Double>> result =
>>> > columnQuery.execute();
>>> >
>>> >         System.out.println("Query result: " + result.get());
>>> >
>>> >
>>> > Is there a equivalent for that in Cassandra CLI?
>>> >
>>> > - Sameer
>>> >
>>> >
>>>
>>>
>>>
>>> --
>>> Jonathan Ellis
>>> Project Chair, Apache Cassandra
>>> co-founder of DataStax, the source for professional Cassandra support
>>> http://www.datastax.com
>>
>>
>
>
>
> --
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of DataStax, the source for professional Cassandra support
> http://www.datastax.com
>

Mime
View raw message