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#驱动程序。
这项工作应该如何,如果是的话,建议的解决方案是什么?