Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D45B7F1AD for ; Tue, 16 Apr 2013 01:25:13 +0000 (UTC) Received: (qmail 11677 invoked by uid 500); 16 Apr 2013 01:25:13 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 11654 invoked by uid 500); 16 Apr 2013 01:25:13 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 11643 invoked by uid 99); 16 Apr 2013 01:25:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Apr 2013 01:25:13 +0000 Date: Tue, 16 Apr 2013 01:25:13 +0000 (UTC) From: "Aleksey Yeschenko (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (CASSANDRA-5474) failure when passing null parameter to prepared statement MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CASSANDRA-5474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Aleksey Yeschenko resolved CASSANDRA-5474. ------------------------------------------ Resolution: Invalid You are doing something wrong. Just tested the same scenario and was able to insert null successfully (also binary protocol). And my client serializes null as signed int32 -1 [0xff,0xff,0xff,0xff]. You probably got your null-serialization code wrong. > 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