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附加到時間戳。 –