We are using Cassandra for time series modeling. Values in a table are inserted with lightweight transactions (CAS).
In the table we have a partition key, a clustering key, and a static column, value from which has to be extracted on read.
We are using select queries of two types: with partition and clustering keys constraints and with partition key constraint only.
When select query without clustering key constraint is applied to an empty partition, the query will return exactly one object with a value from the static column mapped to the corresponding field of that object.
When query with clustering key constraint is applied, and there's exist at least one row in the table that is satisfied this constraint, the query will return all such rows mapped to the objects. The value from the static column will be stored in the appropriate fields of all these objects.
But, if query with clustering key constraint is applied to the empty partition, this query will return an empty collection of objects, despite of what is stored in the static column in this partition. So, retrieval of the data from the static column in this case is not possible without performing an additional query with no clustering key constraint.
In the last case expected behavior would be to get an empty object with static data mapped to it, similarly to the first case (when query without clustering key constraint is applied to the empty partition).
We are thinking, this behavior of the driver is an issue, because additional query, potentially, may lead to the race condition and the overhead due to paxos and lightweight transactions mechanism when reads are performed on a serial consistency level.
This behavior is present in C# driver versions 3.2.1 and 3.2.0.
Actually this is an behavior of cassandra, not the driver itself. Although the static column is attached to partition level, if your query do not have at least 1 row, it wont return the static columns when queried with clustering key.
Maybe you can make use of DISTINCT keyword?