cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Lerer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-10532) Allow LWT operation on static column with only partition keys
Date Tue, 24 Nov 2015 11:49:11 GMT

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

Benjamin Lerer commented on CASSANDRA-10532:
--------------------------------------------

Could you also provide a patch for {{2.1}} ? I checked and the problem is also there.

I have just a few nits:
* In {{2.1}} and {{2.2}} you can simplify the code by using {{!staticConditions.isEmpty()
&& columnConditions.isEmpty()}} to check if the conditions applies only to static
columns
* In {{3.0+}} you can use  {{conditions.appliesToStaticColumns() && !conditions.appliesToRegularColumns()}}
to check if the conditions applies only to static columns 
* In the {{2.2}} patch you adapted the error message for conditions on static columns but
not on the {{3.0+}} patches
* In the {{3.0+}} patches you can simplify {{hasAllPKColumnsRestrictedByEqualities}} by reusing
{{hasAllPartitionKeyColumnsRestrictedByEqualities}}
* In the unit tests you can checks the assertion using {{assertRows}}:
{code}        assertRows(execute("DELETE static_col FROM %s WHERE pk = ? IF static_col = ?",
1, 2), row(false, 1));
        assertRows(execute("DELETE static_col FROM %s WHERE pk = ? IF static_col = ?", 1,
10), row(true));{code}
* Could you use {{assertInvalidMessage}} instead {{assertInvalid}}? We had several cases where
we got the wrong error message

> Allow LWT operation on static column with only partition keys
> -------------------------------------------------------------
>
>                 Key: CASSANDRA-10532
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10532
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL
>         Environment: C* 2.2.0
>            Reporter: DOAN DuyHai
>            Assignee: Carl Yeksigian
>             Fix For: 2.2.x
>
>
> Schema
> {code:sql}
> CREATE TABLE IF NOT EXISTS achilles_embedded.entity_with_static_column(
> id bigint,
> uuid uuid,
> static_col text static,
> value text,
> PRIMARY KEY(id, uuid));
> {code}
> When trying to prepare the following query
> {code:sql}
> DELETE static_col FROM achilles_embedded.entity_with_static_column WHERE id=:id_Eq IF
static_col=:static_col;
> {code}
> I got the error *DELETE statements must restrict all PRIMARY KEY columns with equality
relations in order to use IF conditions, but column 'uuid' is not restricted*
> Since the mutation only impacts the static column and the CAS check is on the static
column, it makes sense to provide only partition key



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message