cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gavin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
Date Thu, 31 Jul 2014 16:30:39 GMT

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

Gavin commented on CASSANDRA-6599:
----------------------------------

Either syntax would work for me, the {{map = map + \{'key1': null, 'key2': null\}...}} option
has the advantage that it allows insert/update/delete to be combined (i.e. {{map = map + \{
'key-to-delete': null, 'key-to-add/update': 'value'\}...}}).  I did test it using Cassandra
2.1.0-rc4 though cqlsh and java driver 2.0.3 but it did not work for me, I've pasted the error
messages below for reference.

from CQLSH:
code=2200 \[Invalid query\] message="null is not supported inside collections"

from java driver using a prepared statement:
Exception in thread "main" java.lang.NullPointerException
at java.nio.CharBuffer.wrap(CharBuffer.java:483)
at com.datastax.driver.core.TypeCodec$StringCodec.serialize(TypeCodec.java:264)
...

from the java driver using a non-prepared statement:
Exception in thread "main" com.datastax.driver.core.exceptions.InvalidQueryException: null
is not supported inside collections
...

> CQL updates should support "column = column - { key1, key2, ... }" syntax for removing
map elements
> ---------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-6599
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6599
>             Project: Cassandra
>          Issue Type: Wish
>            Reporter: Gavin
>            Assignee: Benjamin Lerer
>            Priority: Minor
>              Labels: cql
>             Fix For: 2.1.1
>
>         Attachments: CASSANDRA-6599.txt
>
>
> A variable number number of elements can be removed from lists and sets using an update
statement of the form "update .... set column=column - {....} where ...".  This syntax should
also be supported for map columns.  This would be especially useful for prepared statements
(I know that you can use "set column[...] = null" to remove items in an update statement,
but that only works for one element at a time).



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message