我在使用now()
函数时遇到问题timestamp
类型。DSE/Cassandra CQL now()不适用于时间戳记类型
请看看下面的代码:
创建表:
CREATE TABLE "Test" (
video_id UUID,
upload_timestamp TIMESTAMP,
title VARCHAR,
views INT,
PRIMARY KEY (video_id, upload_timestamp)
) WITH CLUSTERING ORDER BY (upload_timestamp DESC);
有问题的INSERT查询:
INSERT INTO "Test" (video_id, upload_timestamp, title, views)
VALUES (uuid(), now(), 'Test', 0);
插入查询似乎看没什么问题。然而,当我执行它,我看到以下错误:
Unable to execute CQL script on 'XXX': cannot assign result of function now (type timeuuid) to upload_timestamp (type timestamp)
我在做什么错在这里?
我使用DataStax企业4.5.2
它解决了我的问题。非常感谢你。 – kazy 2014-11-04 12:36:34