[
https://issues.apache.org/jira/browse/CASSANDRA-10264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14952843#comment-14952843
]
Sylvain Lebresne commented on CASSANDRA-10264:
----------------------------------------------
On the cqlsh change, I think the new code now exclude "IF x = 3"
({{<conditioncmp>}} doesn't support only {{=}} as far as I can tell).
On the CQL changes, I believe the changes work, but they don't feel very
intuitive to me as it stands. As far as I can tell, we're checking that the
operations are not empty because in the case of a {{DELETE}}, no operations
means we have a {{DELETE FROM ...}}, that is we're deleting all columns
implicitely. But I don't think this is entirely clear from the code so this
deserve a comment but I would also feel more comfortable if we were guarding
the 'operations not empty' check by whether the statement is a {{DELETE}} as
having 'no operations' for an {{INSERT}} doesn't mean the same thing.
In fact, on 3.0, I'd find it more intuitive to move the logic inside
{{Operations}}. Namely, I'd change {{Operations.appliesToRegularColumns()}} to
be:
{noformat}
public boolean appliesToRegularColumns()
{
// If we have regular operations, this applies to regular columns.
// Otherwise, if the statement is a DELETE and staticOperations is also
empty, this means we have no operations,
// which for a DELETE means a full row deletion. Which means the operation
applies to all columns and regular ones in particular.
return !regularOperations.isEmpty() || (statementType ==
StatementType.DELETE && staticOperations.isEmpty());
}
{noformat}
which require to feed the {{StatemenType}} to the {{Operations}} ctor, but
that's easy enough.
> Unable to use conditions on static columns for DELETE
> -----------------------------------------------------
>
> Key: CASSANDRA-10264
> URL: https://issues.apache.org/jira/browse/CASSANDRA-10264
> Project: Cassandra
> Issue Type: Bug
> Components: Core
> Environment: Cassandra 2.2.0
> Reporter: DOAN DuyHai
> Assignee: Benjamin Lerer
> Attachments: 10264-2.1.txt, 10264-3.0.txt
>
>
> {noformat}
> cqlsh:test> create table static_table(id int, stat int static, ord int, val
> text, primary key(id,ord));
> cqlsh:test> insert into static_table (id,stat,ord,val) VALUES ( 1, 1, 1, '1');
> cqlsh:test> delete from static_table where id=1 and ord=1 if stat != 1;
> Invalid syntax at line 1, char 55
> delete from static_table where id=1 and ord=1 if stat != 1;
> ^
> {noformat}
> Same error if using =, <, <=, >= or > condition
> According to [~thobbs] the syntax should work. Plus, the error message is
> wrong
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)