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

Benjamin Lerer commented on CASSANDRA-16686:
--------------------------------------------

When an CQL query is done at the partition level (without clustering or regular 
column restrictions), if a partition does not contains any row but contains 
some static columns a row will be returned to the user with {{null}} values for 
all the clustering and regular columns.  
Since CASSANDRA-12768, Cassandra fetch all the regular columns but only the 
static columns that have been selected by the user. By consequence, Cassandra 
will fetch only {{s1}} for the {{SELECT s1 FROM %s WHERE pk=1}} query from the 
description example. Due to that it will NOT attempt to fetch the {{s2}} value 
and will look only at the third and second SSTables. The partition having no 
value for {{s1}} Cassandra will consider the partition empty and will not 
return a row for it as it should. 
    

> Queries returning static content when the partition has no rows might fail to 
> return some rows
> ----------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-16686
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16686
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL/Interpreter
>            Reporter: Benjamin Lerer
>            Assignee: Benjamin Lerer
>            Priority: Normal
>             Fix For: 4.0-rc
>
>
> The problem can be reproduced with the following test:
> {code}
>     @Test
>     public void testStaticColumnDeletionWithMultipleStaticColumns() throws 
> Throwable
>     {
>         createTable("CREATE TABLE %s (pk int, ck int, s1 int static, s2 int 
> static, v int, PRIMARY KEY(pk, ck))");
>         execute("INSERT INTO %s (pk, s1, s2) VALUES (1, 1, 1) USING TIMESTAMP 
> 1000");
>         flush();
>         execute("INSERT INTO %s (pk, s1) VALUES (1, 2) USING TIMESTAMP 2000");
>         flush();
>         execute("DELETE s1 FROM %s USING TIMESTAMP 3000 WHERE pk = 1");
>         flush();
>         assertRows(execute("SELECT * FROM %s WHERE pk=1"), row(1, null, null, 
> 1, null));
>         assertRows(execute("SELECT s1, s2 FROM %s WHERE pk=1"), row((Integer) 
> null, 1));
>         assertRows(execute("SELECT s1 FROM %s WHERE pk=1"), row((Integer) 
> null)); // <-FAIL
>     }
> {code}
> This problem is a regression in 4.0 and trunk



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to