cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pierre Chalamet (JIRA)" <>
Subject [jira] [Created] (CASSANDRA-5474) failure when passing null parameter to prepared statement
Date Mon, 15 Apr 2013 21:20:16 GMT
Pierre Chalamet created CASSANDRA-5474:

             Summary: failure when passing null parameter to prepared statement
                 Key: CASSANDRA-5474
             Project: Cassandra
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.2.4
         Environment: windows 8 x64, 1.7.0_11-b21 x64
            Reporter: Pierre Chalamet

I have a failure when passing a null parameter to the prepared statement bellow when going
through the cql 3 bin protocol:

Exec: CREATE KEYSPACE Tests WITH replication = {'class': 'SimpleStrategy', 'replication_factor'
: 1}

Exec: CREATE TABLE Tests.AllTypes (a int, b int, primary key (a))

Prepare: insert into Tests.AllTypes (a, b) values (?, ?)

Passing a=1 and b=null cause the following error:

DEBUG 23:07:23,315 Responding: RESULT PREPARED 59b3d6baed67d5c0a3ced29ebb4277c5 [a(tests,
alltypes), org.apache.cassandra.db.marshal.Int32Type][b(tests, alltypes), org.apache.cassandra.db.marshal.Int32Type]
DEBUG 23:07:23,292 Compaction buckets are []
DEBUG 23:07:23,336 Received: EXECUTE 59b3d6baed67d5c0a3ced29ebb4277c5 with 2 values at consistency
ERROR 23:07:23,338 Unexpected exception during request
        at org.apache.cassandra.db.marshal.Int32Type.validate(
        at org.apache.cassandra.cql3.Constants$Marker.bindAndGet(
        at org.apache.cassandra.cql3.Constants$Setter.execute(
        at org.apache.cassandra.cql3.statements.UpdateStatement.mutationForKey(
        at org.apache.cassandra.cql3.statements.UpdateStatement.getMutations(
        at org.apache.cassandra.cql3.statements.ModificationStatement.execute(
        at org.apache.cassandra.cql3.QueryProcessor.processStatement(
        at org.apache.cassandra.cql3.QueryProcessor.processPrepared(
        at org.apache.cassandra.transport.messages.ExecuteMessage.execute(
        at org.apache.cassandra.transport.Message$Dispatcher.messageReceived(
        at org.jboss.netty.handler.execution.ChannelUpstreamEventRunnable.doRun(
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$ Source)
        at Source)
DEBUG 23:07:23,337 No tasks available
DEBUG 23:07:23,341 request complete
DEBUG 23:07:23,343 Responding: ERROR SERVER_ERROR: java.lang.NullPointerException

When serializing value for b, a bytes array of len -1 is transmitted (accordingly to the spec):
[bytes] A [int] n, followed by n bytes if n >= 0. If n < 0,
        no byte should follow and the value represented is `null`.

CASSANDRA-5081 added support for null params. Am I doing something wrong there ? Thanks.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message