Hi Brian, Thanks for the report. This looks like https://issues.apache.org/jira/browse/CASSANDRA-7155, which should be fixed shortly.
On Thu, May 15, 2014 at 3:23 PM, Brian O'Neill <[email protected]>wrote: > > OK ‹ we¹ve got some hyper data modeling going on, taking advantage of all > the latest toys in CQL 2. And we ran into some trouble using maps within > conditional updates. Specifically, when testing to see if a key exists in > a > map (with =null?), we encounter an NPE server-side. We believe this worked > in 2.0.4. > > With this schema: > CREATE TABLE progress ( > key text, > count int, > partitions map<text, timestamp>, > primary key (key) > ); > > When executing the following: > cqlsh:hms> UPDATE foo SET count=4962 WHERE key='PA' IF > partitions['a']=null; > > [applied] > ----------- > False > > cqlsh:hms> UPDATE foo SET count=4962 WHERE key='PA'; > cqlsh:hms> UPDATE foo SET count=4962 WHERE key='PA' IF > partitions['a']=null; > TSocket read 0 bytes > > We see the following NPE server-side: > ERROR [Native-Transport-Requests:13353] 2014-05-15 15:10:00,154 > QueryMessage.java (line 131) Unexpected error during query > java.lang.NullPointerException > at > > org.apache.cassandra.cql3.ColumnCondition$WithVariables.collectionAppliesTo( > ColumnCondition.java:168) > at > > org.apache.cassandra.cql3.ColumnCondition$WithVariables.appliesTo(ColumnCond > ition.java:142) > at > > org.apache.cassandra.cql3.statements.CQL3CasConditions$ColumnsConditions.app > liesTo(CQL3CasConditions.java:197) > at > > org.apache.cassandra.cql3.statements.CQL3CasConditions.appliesTo(CQL3CasCond > itions.java:108) > > Is there a better way to test for existence of a key? > Or is this a bug? (Regardless, we may want to protect against the NPE) > Or am I missing something entirely? > > -brian > > --- > Brian O'Neill > Chief Technology Officer > > > Health Market Science > The Science of Better Results > 2700 Horizon Drive € King of Prussia, PA € 19406 > M: 215.588.6024 € @boneill42 <http://www.twitter.com/boneill42> € > healthmarketscience.com > > > This information transmitted in this email message is for the intended > recipient only and may contain confidential and/or privileged material. If > you received this email in error and are not the intended recipient, or the > person responsible to deliver it to the intended recipient, please contact > the sender at the email above and delete this email and any attachments and > destroy any copies thereof. Any review, retransmission, dissemination, > copying or other use of, or taking any action in reliance upon, this > information by persons or entities other than the intended recipient is > strictly prohibited. > > > > -- Tyler Hobbs DataStax <http://datastax.com/>
