[ 
https://issues.apache.org/jira/browse/CASSANDRA-5474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13632636#comment-13632636
 ] 

Pierre Chalamet commented on CASSANDRA-5474:
--------------------------------------------

Really not sure.

Here is the frame I'm sending, and this fails.

{code}
// header
1, 0, 125, 10

// len
0, 0, 0, 34

// body

// requestId
0, 16, 
89, 179, 214, 186, 237, 103, 213, 192, 163, 206, 210, 158, 187, 66, 119, 197

// nb columns
0, 2, 

// a = 1
0, 0, 0, 4
0, 0, 0, 1

// b = null
255, 255, 255, 255

// CL
0, 4
{code}
                
> failure when passing null parameter to prepared statement
> ---------------------------------------------------------
>
>                 Key: CASSANDRA-5474
>                 URL: https://issues.apache.org/jira/browse/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:
> {code}
> 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 (?, ?)
> {code}
> Passing a=1 and b=null cause the following error:
> {code}
> 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 QUORUM
> ERROR 23:07:23,338 Unexpected exception during request
> java.lang.NullPointerException
>         at 
> org.apache.cassandra.db.marshal.Int32Type.validate(Int32Type.java:95)
>         at 
> org.apache.cassandra.cql3.Constants$Marker.bindAndGet(Constants.java:257)
>         at 
> org.apache.cassandra.cql3.Constants$Setter.execute(Constants.java:282)
>         at 
> org.apache.cassandra.cql3.statements.UpdateStatement.mutationForKey(UpdateStatement.java:250)
>         at 
> org.apache.cassandra.cql3.statements.UpdateStatement.getMutations(UpdateStatement.java:133)
>         at 
> org.apache.cassandra.cql3.statements.ModificationStatement.execute(ModificationStatement.java:92)
>         at 
> org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:132)
>         at 
> org.apache.cassandra.cql3.QueryProcessor.processPrepared(QueryProcessor.java:254)
>         at 
> org.apache.cassandra.transport.messages.ExecuteMessage.execute(ExecuteMessage.java:122)
>         at 
> org.apache.cassandra.transport.Message$Dispatcher.messageReceived(Message.java:287)
>         at 
> org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
>         at 
> org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:565)
>         at 
> org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:793)
>         at 
> org.jboss.netty.handler.execution.ChannelUpstreamEventRunnable.doRun(ChannelUpstreamEventRunnable.java:45)
>         at 
> org.jboss.netty.handler.execution.ChannelEventRunnable.run(ChannelEventRunnable.java:69)
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>         at java.lang.Thread.run(Unknown 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
> {code}
> When serializing value for b, a bytes array of len -1 is transmitted 
> (accordingly to the spec):
> {code}
> [bytes] A [int] n, followed by n bytes if n >= 0. If n < 0,
>         no byte should follow and the value represented is `null`.
> {code}
> 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: http://www.atlassian.com/software/jira

Reply via email to