1
我是cassandra的新手,目前正在尝试datastax的温度范例。 在这个例子中,我创建具有以下DDL的表:包含以下数据如何让cassandra正确过滤?
CREATE TABLE mykeyspace.temperature (
weatherstation_id text,
event_time timestamp,
temperature text,
PRIMARY KEY (weatherstation_id, event_time)
) WITH read_repair_chance = 0.0
AND dclocal_read_repair_chance = 0.1
AND gc_grace_seconds = 864000
AND 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', 'max_threshold' : 32, 'min_threshold' : 4 }
AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' }
AND default_time_to_live = 0
AND speculative_retry = '99PERCENTILE'
AND min_index_interval = 128
AND max_index_interval = 2048
AND crc_check_chance = 1.0;
:
cqlsh> use mykeyspace;
cqlsh:mykeyspace> select * from temperature where weatherstation_id='1234ABCD'
... ;
weatherstation_id | event_time | temperature
-------------------+--------------------------+-------------
1234ABCD | 2013-04-03 06:01:00+0000 | 72F
1234ABCD | 2013-04-03 06:02:00+0000 | 73F
1234ABCD | 2013-04-03 06:03:00+0000 | 73F
1234ABCD | 2013-04-03 06:04:00+0000 | 74F
1234ABCD | 2013-04-03 06:05:00+0000 | 72F
1234ABCD | 2013-04-03 07:01:00+0000 | 72F
然而,过滤不工作,还是回到了全套当我运行以下CQL:
select * from temperature where weatherstation_id='1234ABCD' and event_time > '2013-04-03 06:05:00';
我是否了解病情错了吗?
谢谢亚伦:)我终于在添加时区偏移量+ xxxx后才能使用它。奇怪的是我已经将本地时区更改为GMT,但我仍然需要将+0000附加到时间戳。 –