【问题标题】:toTimestamp function is not working in select statement cassandratoTimestamp 函数在选择语句 cassandra 中不起作用
【发布时间】:2017-10-18 22:53:05
【问题描述】:

我有桌子

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

【问题讨论】:

    标签: cassandra timeuuid to-timestamp


    【解决方案1】:

    在 Cassandra 2.2 中引入了toTimestamp
    检查Cassandra Release News

    您也可以创建自己的函数。 Cheeck UDF。 UDF 也在 Cassandra 2.2 中引入

    如果您使用低于 2.2 的 Cassandra,则无法使用此功能。

    【讨论】:

    • 谢谢 Ashraful,我看看能不能更新 cassandra。
    猜你喜欢
    • 2013-03-04
    • 2018-09-19
    • 2015-05-14
    • 1970-01-01
    • 1970-01-01
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多