Lex Lythius created CASSANDRA-10279:
---------------------------------------
Summary: Inconsistent update/delete behavior for static lists vs
lists
Key: CASSANDRA-10279
URL: https://issues.apache.org/jira/browse/CASSANDRA-10279
Project: Cassandra
Issue Type: Bug
Components: Core
Environment: [cqlsh 5.0.1 | Cassandra 2.2.0 | CQL spec 3.3.0 | Native
protocol v4]
Ubuntu 14.04 x64
Reporter: Lex Lythius
Partial list deletions (either in the form of {{UPDATE list = list - \[...]}}
or {{DELETE list\[index]}} form) work fine in regular list columns, but do
nothing or throw bad index error when applied to *static* list columns.
Example:
{code:sql}
create table t_lists (
id int,
dt int,
ls list<ascii>,
sls list<ascii> static,
primary key(id, dt)
);
cqlsh:test> update t_lists set ls = ['foo', 'bar', 'baz'], sls = ['chico',
'harpo', 'zeppo', 'groucho'] where id=1 and dt=1;
cqlsh:test> select * from t_lists;
id | dt | sls | ls
----+----+----------------------------------------+-----------------------
1 | 1 | ['chico', 'harpo', 'zeppo', 'groucho'] | ['foo', 'bar', 'baz']
(1 rows)
cqlsh:test> delete ls[2] from t_lists where id = 1 and dt = 1; -- works
cqlsh:test> delete sls[2] from t_lists where id = 1; -- errors
InvalidRequest: code=2200 [Invalid query] message="Attempted to delete an
element from a list which is null"
cqlsh:test> select * from t_lists;
id | dt | sls | ls
----+----+----------------------------------------+----------------
1 | 1 | ['chico', 'harpo', 'zeppo', 'groucho'] | ['foo', 'bar']
(1 rows)
cqlsh:test> update t_lists set ls = ls - ['bar'] where id=1 and dt=1; -- works
cqlsh:test> update t_lists set sls = sls - ['zeppo'] where id=1; -- fails
silently
cqlsh:test> select * from t_lists;
id | dt | sls | ls
----+----+----------------------------------------+---------
1 | 1 | ['chico', 'harpo', 'zeppo', 'groucho'] | ['foo']
(1 rows)
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)