cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aleksey Yeschenko (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-5474) failure when passing null parameter to prepared statement
Date Tue, 16 Apr 2013 14:27:16 GMT

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

Aleksey Yeschenko commented on CASSANDRA-5474:
----------------------------------------------

Interesting. The frame indeed looks correct, and an analogous one seems to work all right
for me (1.2.4 and latest cassandra-1.2 branch both).

{noformat}
<<1,0,0,10,
  0,0,0,34,
  0,16,228,43,12,34,120,160,113,48,251,103,244,149,202,119,0,103,
  0,2,
  0,0,0,4,0,0,0,1,
  255,255,255,255,
  0,4>>
{noformat}

Frame id and query id are different, but other than that the two frames are identical.

                
> 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

Mime
View raw message