[jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
[ https://issues.apache.org/jira/browse/CASSANDRA-6599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=1415#comment-1415 ] Aleksey Yeschenko commented on CASSANDRA-6599: -- v2 LGTM Nits: - CQLTester#assertInvalid() catch should include SyntaxException - removing it caused TupleTypeTest and MultiColumnRelationTest to fail. (Maybe the problem is a bit deeper, but reverting that change fixes the issue) - Sets.Discarder comments have a couple 'subsctraction' typos (must be 'subtraction') - introduced not by this patch, but by an earlier 86e3012633866d049ac3898ed710ee278b7de3ee commit, somehow > 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: 6599-proto.txt, 6599-v2.txt, 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)
[jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
[ https://issues.apache.org/jira/browse/CASSANDRA-6599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14094163#comment-14094163 ] Aleksey Yeschenko commented on CASSANDRA-6599: -- Oh well. - set it is then. > 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: 6599-proto.txt, 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)
[jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
[ https://issues.apache.org/jira/browse/CASSANDRA-6599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14094157#comment-14094157 ] Sylvain Lebresne commented on CASSANDRA-6599: - Looking closer, adding nulls to maps is a little more involved than it sound and I'm not sure how eager I am with biting that bullet. First there is a couple of methods in {{MapType}} and {{MapSerializers}} that would need to handle null for values but that's not a big deal. But it's a bit annoying for UDTs/tuples. Namely, keeping the nulls when the map is inside a UDT would be kind of inconsistent behavior, but removing the null values would require forcing a deserialization of every UDT value (potentially with nesting) just for that. Given that, I'm actually starting to think that just suppporting the {{...map - \{2, 3\}...}} syntax is just easier. As a side note, even if we were to add syntax for nulls as map values, it won't make sense for lists, sets or map keys, so there is an element of consistencies in keeping the "no nulls in collection" rules. > 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: 6599-proto.txt, 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)
[jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
[ https://issues.apache.org/jira/browse/CASSANDRA-6599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14084924#comment-14084924 ] Aleksey Yeschenko commented on CASSANDRA-6599: -- Right. What I'm uncertain about is whether or not the sugar is worth the extra code/inconsistency introduces, once there is already a simple enough way to do it. > 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: 6599-proto.txt, 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)
[jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
[ https://issues.apache.org/jira/browse/CASSANDRA-6599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14084849#comment-14084849 ] Sylvain Lebresne commented on CASSANDRA-6599: - bq. I have a minor preference for simply allowing nulls as map values I'm good adding nulls for map values though for the record, let me note that up until protocol v3 there is no way to serialize collections with nulls inside (so this won't be useful for v1/v2 drivers when using prepared statement). It's ok since this ticket is targeted at 2.1, again, just mentioning it for the record. Though for what it's worth I wouldn't personally mind supporting the {{..map - \{2, 3\}...}} syntax either: yes, it's subtracting a set to a map, but it feel intuitive enough to me to not be confusing and I can see it as reasonable syntactic sugar. > 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: 6599-proto.txt, 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)
[jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
[ https://issues.apache.org/jira/browse/CASSANDRA-6599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14081085#comment-14081085 ] Aleksey Yeschenko commented on CASSANDRA-6599: -- I *think* we should be able to lift the null-restriction from map values - don't remember why we have it there in the first place. Will look into it. > 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)
[jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
[ 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)
[jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
[ https://issues.apache.org/jira/browse/CASSANDRA-6599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14081015#comment-14081015 ] Aleksey Yeschenko commented on CASSANDRA-6599: -- FWIW for the non-prepared case it's also possible to do {code} delete map['key1'], map['key2'], map['keyN'] from table where ...; {code} to get the same result. > 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)
[jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
[ https://issues.apache.org/jira/browse/CASSANDRA-6599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14081013#comment-14081013 ] Aleksey Yeschenko commented on CASSANDRA-6599: -- More intuitive, but also inconsistent. Looks like trying to subtract a set from a map, which looks ugly to me. Of course I admit that this is subjective. So I'm not closing the issue as Won't Fix or Not A Problem, but leave it open instead, until more input. > 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)
[jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
[ https://issues.apache.org/jira/browse/CASSANDRA-6599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14081004#comment-14081004 ] Robert Stupp commented on CASSANDRA-6599: - bq. not sure I like accepting set literals for map operations. but a {{map_col - \{'keyFoo', 'keyBar'\}}} is more intutivie IMO - and closer to the [syntax to remove set elements|http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/update_r.html?scroll=reference_ds_g4h_qzq_xj__using-a-collection-set] > 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)
[jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
[ https://issues.apache.org/jira/browse/CASSANDRA-6599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14080869#comment-14080869 ] Aleksey Yeschenko commented on CASSANDRA-6599: -- After thinking about it for a while, I'm not sure I like accepting set literals for map operations. I personally would prefer allowing nulls as values in map literals, so that you could do something like this instead, without inventing new syntax: {code} update table set map = map + {'key1': null, 'key2': null} where ... {code} I believe this already works with prepared statements, as is, but could be wrong. > 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)
[jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
[ https://issues.apache.org/jira/browse/CASSANDRA-6599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14063537#comment-14063537 ] Jonathan Ellis commented on CASSANDRA-6599: --- I'd be more comfortable with 2.1.1 for this than slipping it in right before 2.1.0. > 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.0 > > 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)
[jira] [Commented] (CASSANDRA-6599) CQL updates should support "column = column - { key1, key2, ... }" syntax for removing map elements
[ https://issues.apache.org/jira/browse/CASSANDRA-6599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14060595#comment-14060595 ] Aleksey Yeschenko commented on CASSANDRA-6599: -- In versions that won't have this patch, you can simply batch those update statements and get the exact same result. > 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.0 > > 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)