You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Benjamin Lerer (Jira)" <ji...@apache.org> on 2024/05/16 14:29:00 UTC
[jira] [Updated] (CASSANDRA-19637) LWT conditions on MultiCell collections return invalid results
[ https://issues.apache.org/jira/browse/CASSANDRA-19637?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benjamin Lerer updated CASSANDRA-19637:
---------------------------------------
Description:
Due to the way multicell collections are implemented, it is not possible to differentiate between {{null}} and empty collections like it is feasible for single cell (frozen) collections. Therefore an empty multicell collection will always be treated as {{null}}.
Unfortunately, the way LWT conditions handle that is not consistent with that.
For example for {{colA list<int>}} non null: {code}.. IF colA >= null{code} will throw an invalid request error whereas {code}..IF colA >= []{code} will returns {{true}}.
Moreover, if we insert an empty list through:
{code}INSERT INTO mytable (pk, colA) VALUES (1, []);{code}
and use {code}DELETE FROM mytable WHERE pk=1 IF colA >= []{code} the returned results will be {false, null}. Which can be quite confusing.
The way to fix that behaviour to make it consistent with other operations like is to consider empty multicell collection input as {{null}}.
was:
Due to the way multicell collections are implemented, it is not possible to differentiate between {{null}} and empty collections like it is feasible for single cell (frozen) collections. Therefore an empty multicell collection will always be treated as {{null}}.
Unfortunately, the way LWT conditions handle that is not consistent with that.
For example for {{colA list<int>}} non null: {code}.. IF colA >= null{code} will throw an invalid request error whereas {code}..IF colA >= []{code} will returns {{true}}.
Moreover, if we insert en empty list through:
{code}INSERT INTO mytable (pk, colA) VALUES (1, []);{code}
and use {code}DELETE FROM mytable WHERE pk=1 IF colA >= []{code} the returned results will be {false, null}. Which can be quite confusing.
The way to fix that behaviour to make it consistent with other operations like is to consider empty multicell collection input as {{null}}.
> LWT conditions on MultiCell collections return invalid results
> --------------------------------------------------------------
>
> Key: CASSANDRA-19637
> URL: https://issues.apache.org/jira/browse/CASSANDRA-19637
> Project: Cassandra
> Issue Type: Bug
> Components: CQL/Semantics
> Reporter: Benjamin Lerer
> Priority: Normal
>
> Due to the way multicell collections are implemented, it is not possible to differentiate between {{null}} and empty collections like it is feasible for single cell (frozen) collections. Therefore an empty multicell collection will always be treated as {{null}}.
> Unfortunately, the way LWT conditions handle that is not consistent with that.
> For example for {{colA list<int>}} non null: {code}.. IF colA >= null{code} will throw an invalid request error whereas {code}..IF colA >= []{code} will returns {{true}}.
> Moreover, if we insert an empty list through:
> {code}INSERT INTO mytable (pk, colA) VALUES (1, []);{code}
> and use {code}DELETE FROM mytable WHERE pk=1 IF colA >= []{code} the returned results will be {false, null}. Which can be quite confusing.
> The way to fix that behaviour to make it consistent with other operations like is to consider empty multicell collection input as {{null}}.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org