Serialization of negative integers & longs fails #111

Closed
metanet opened this Issue Sep 5, 2012 · 2 comments

Comments

Projects
None yet
3 participants
@metanet

metanet commented Sep 5, 2012

Hi there,

I am having issues with inserting negative numbers to a column family which is defined with cql 3 just like below:

create table logs
(
uid bigint,
ts bigint,
sid bigint,
duration bigint,
scount int,
PRIMARY KEY (uid, ts)
);

As you can see, I defined "uid" as row key and "ts" as first component of my composite column names.

I am inserting rows to this column family both from cqlsh and Astyanax client. While using Astyanax client, when I set one of the sid, duration and scount columns' values to a negative number, operation throws an exception like printed below:

"com.netflix.astyanax.connectionpool.exceptions.BadRequestException: BadRequestException: [host=127.0.0.1(127.0.0.1):9160, latency=30(47), attempts=1] InvalidRequestException(why:(String didn't validate.) [metanet][logs][1346771673482:scount] failed validation)"

Exception message does not make sense to me. Only the second part of my composite column key is string and why it is invalid when column number is negative?

When I set positive numbers to my sid, duration, scount columns, row is inserted successfully. And also I can insert rows with negative column values via cqlsh and I can query them from Astyanax client and get negative column values successfully.

Here is the code for my insert operation:

        MutationBatch m = keyspace.prepareMutationBatch();

        long ts = System.currentTimeMillis();
        m.withRow( logsCF, 1L )
         .putColumn( new LogCK(ts, "scount"), -1 )
         .putColumn( new LogCK(ts, "sid"), 1L )
         .putColumn( new LogCK(ts, "duration"), 30L );

        m.execute();

I could not see what is wrong with my code or column family definition.

My Astyanax version is 1.0.6 and cassandra version is 1.1.2 which is downloaded from DataStax web site.

@sagarl

This comment has been minimized.

Show comment Hide comment
@sagarl

sagarl Feb 12, 2014

Contributor

Works with C* 1.2, hence closing it.

Contributor

sagarl commented Feb 12, 2014

Works with C* 1.2, hence closing it.

@sagarl sagarl closed this Feb 12, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment