1
我有一個時間序列密鑰空間見下表:查詢卡桑德拉在C#
CREATE TABLE underlying_data (
symbol text,
ask decimal,
bid decimal,
ts bigint,
PRIMARY KEY ((symbol))
) WITH
bloom_filter_fp_chance=0.010000 AND
caching='KEYS_ONLY' AND
comment='' AND
dclocal_read_repair_chance=0.100000 AND
gc_grace_seconds=864000 AND
index_interval=128 AND
read_repair_chance=0.000000 AND
replicate_on_write='true' AND
populate_io_cache_on_flush='false' AND
default_time_to_live=0 AND
speculative_retry='99.0PERCENTILE' AND
memtable_flush_period_in_ms=0 AND
compaction={'class': 'SizeTieredCompactionStrategy'} AND
compression={'sstable_compression': 'LZ4Compressor'};
CREATE INDEX underlying_data_ts_idx ON underlying_data (ts);
cqlsh:timeseries>
我嘗試查詢從C#這個表中插入一些項目,如在此之後:
static long ninetySeventyTicks = new DateTime(1970, 1, 1).Ticks;
Cluster cluster = Cluster.Builder().AddContactPoint("127.0.0.1").Build();
ISession session = cluster.Connect("timeseries");
RowSet result = session.Execute("SELECT symbol, ts FROM underlying_data WHERE ts > "
+ ninetySeventyTicks.ToString()
+ " and symbol = 'SPX'"
//+ "AllowFiltering"
+ ";");
rows = result.GetRows();
,但我得到的例外:
Message = "No indexed columns present in by-columns clause with Equal operator"
我從一本關於查詢cassandra的書中複製了這個例子。唯一的區別是本書使用CQL而不是C#驅動程序。
這項工作應該如何,如果是的話,建議的解決方案是什麼?