Note that there are some explanatory texts on larger screens.

plurals
  1. POComposite columns and "IN" relation in Cassandra
    primarykey
    data
    text
    <p>I have the following column family in Cassandra for storing time series data in a small number of very "wide" rows:</p> <pre><code>CREATE TABLE data_bucket ( day_of_year int, minute_of_day int, event_id int, data ascii, PRIMARY KEY (data_of_year, minute_of_day, event_id) ) </code></pre> <p>On the CQL shell, I am able to run a query such as this:</p> <pre><code>select * from data_bucket where day_of_year = 266 and minute_of_day = 244 and event_id in (4, 7, 11, 1990, 3433) </code></pre> <p>Essentially, I fix the value of the first component of the composite column name (minute_of_day) and want to select a non-contiguous set of columns based on the distinct values of the second component (event_id). Since the "IN" relation is interpreted as an equality relation, this works fine.</p> <p>Now my question is, how would I accomplish the same type of composite column slicing programmatically and without CQL. So far I have tried the Python client pycassa and the Java client Astyanax, but without any success.</p> <p>Any thoughts would be welcome.</p> <p>EDIT:</p> <p>I'm adding the describe output of the column family as seen through cassandra-cli. Since I am looking for a Thrift-based solution, maybe this will help.</p> <pre><code>ColumnFamily: data_bucket Key Validation Class: org.apache.cassandra.db.marshal.Int32Type Default column value validator: org.apache.cassandra.db.marshal.AsciiType Cells sorted by: org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.Int32Type) GC grace seconds: 864000 Compaction min/max thresholds: 4/32 Read repair chance: 0.1 DC Local Read repair chance: 0.0 Populate IO Cache on flush: false Replicate on write: true Caching: KEYS_ONLY Bloom Filter FP chance: default Built indexes: [] Compaction Strategy: org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy Compression Options: sstable_compression: org.apache.cassandra.io.compress.SnappyCompressor </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload