I have the following Cassandra table
cqlsh:mydb> describe table events; CREATE TABLE mydb.events ( id uuid PRIMARY KEY, country text, insert_timestamp timestamp ) WITH bloom_filter_fp_chance = 0.01 AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}' AND comment = '' AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'} AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'} AND dclocal_read_repair_chance = 0.1 AND default_time_to_live = 0 AND gc_grace_seconds = 864000 AND max_index_interval = 2048 AND memtable_flush_period_in_ms = 0 AND min_index_interval = 128 AND read_repair_chance = 0.0 AND speculative_retry = '99.0PERCENTILE'; CREATE INDEX country_index ON mydb.events (country); CREATE INDEX insert_timestamp_index ON mydb.events (insert_timestamp);
As you can see, the index has already been created in the insert_timestamp
column.
I walked through https://stackoverflow.com/a/312969/
I believe the correct request
cqlsh:mydb> select * from events where insert_timestamp >= '2016-03-01 08:27:22+0000'; InvalidRequest: code=2200 [Invalid query] message="No secondary indexes on the restricted columns support the provided operators: 'insert_timestamp >= <value>'" cqlsh:mydb> select * from events where insert_timestamp >= '2016-03-01 08:27:22+0000' ALLOW FILTERING; InvalidRequest: code=2200 [Invalid query] message="No secondary indexes on the restricted columns support the provided operators: 'insert_timestamp >= <value>'"
But a query with a country
column is executed as a WHERE clause .
cqlsh:mydb> select * from events where country = 'my'; id | country | insert_timestamp --------------------------------------+---------+-------------------------- 53167d6a-e125-46ff-bacf-f5b267de0258 | my | 2016-03-01 08:27:22+0000
Any idea why a query with a timestamp as a condition does not work? Is there something wrong with the query syntax?
source share