2017-05-18 63 views
0

工作,我有表作爲toTimestamp功能沒有在SELECT語句卡桑德拉

cqlsh> DESC relation.students; 

CREATE TABLE relation.students (
    student_id uuid, 
    created_at timeuuid, 
    name text, 
    PRIMARY KEY (student_id, created_at) 
) WITH CLUSTERING ORDER BY (created_at DESC) 
    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'} 
    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 index_students_student_id ON relation.students (student_id); 

當我檢查timeuuid functions,它有toTimestamp功能,當我嘗試使用,它提供了錯誤。

cqlsh> select student_id, name, toTimestamp(created_at) from relation.students where student_id=c2e160e6-27bb-4e25-91ca-e33dc7538d25; 
InvalidRequest: code=2200 [Invalid query] message="Unknown function 'toTimestamp'" 

我使用的版本2.1

cqlsh> select peer, release_version from system.peers; 

peer  | release_version 
-------------+----------------- 
    127.0.0.1 |  2.1.14.1272 

回答

1

在卡桑德拉2.2引入toTimestamp
檢查Cassandra Release News

您也可以創建自己的功能。 Cheeck UDF。 UDF也在Cassandra 2.2中引入

如果使用的Cassandra低於2.2,則不能使用此函數。

+0

謝謝Ashraful,我會看看我是否可以更新cassandra。 – Nilesh