DataStax Help Center

CQL reversed queries returns null values for static columns

Summary

Queries involving static columns return null values when the order is reversed.

Symptoms

To illustrate the problem, consider the following table definition:

CREATE TABLE myCF (
a text,
b text,
x text static,
PRIMARY KEY (a,b)
)

A simple query showing the table's contents:

cqlsh:myKS> SELECT * FROM myCF ;

a | b | x
----+-----+-----
one | two | ten

When querying the table with a reversed order on the 2nd column, the static column is returned with a null value:

cqlsh:myKS> SELECT * FROM myCF WHERE a = 'one' ORDER BY b DESC;

a | b | x
----+-----+------
one | two | null

Cause

The issue is due to a known defect in Cassandra (CASSANDRA-8502).

Static columns are not fetched in a reversed query and requires an additional fetch under the hood.

Solution

The defect has been fixed in Cassandra versions 2.0.16, 2.1.6 and 2.2. Upgrade to DSE releases which ship with these versions of Cassandra.

DSE 4.7.1 ships with Cassandra 2.1.8 which includes the fix.

DSE 4.6.8 ships with Cassandra 2.0.16 which also includes the fix.

See also

Defect - [CASSANDRA-8502] "Static columns returning null for pages after first".

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk