Cassandra:Select 条记录基于 "timeuuid where conditions"

Cassandra : Select records based on "timeuuid where conditions"

我在 Cassandra 中创建了一个 table 并且想要 select 基于具有 timeuuid 类型的列的条件的数据。

CREATE TABLE shahid.stock_ticks(
symbol varchar,
date int,
trade timeuuid,
trade_details text,
PRIMARY KEY (  (symbol, date), trade   )
) WITH CLUSTERING ORDER BY (trade DESC) ;

INSERT INTO shahid.stock_ticks (symbol, date, trade, trade_details) VALUES ('NFLX', 1, now(), 'this is 10' );
INSERT INTO shahid.stock_ticks (symbol, date, trade, trade_details) VALUES ('NFLX', 1, now(), 'this is 2' );
INSERT INTO shahid.stock_ticks (symbol, date, trade, trade_details) VALUES ('NFLX', 1, now(), 'this is 3' );

以上查询已插入记录,其中一条记录在贸易列中的值为“2045d660-9415-11e5-9742-c53da2f1a8ec”。

我想 select 这样,但它给出了错误

select * from shahid.stock_ticks  where symbol = 'NFLX' and date = 1 and trade < '2045d660-9415-11e5-9742-c53da2f1a8ec';

给出以下错误

InvalidQueryException: Invalid STRING constant (2045d660-9415-11e5-9742-c53da2f1a8ec) for "trade" of type timeuuid

我也尝试了以下查询,但没有成功

select * from shahid.stock_ticks  where symbol = 'NFLX' and date = 1 and trade < maxTimeuuid('2045d660-9415-11e5-9742-c53da2f1a8ec');
select * from shahid.stock_ticks  where symbol = 'NFLX' and date = 1 and trade < dateOf('2045d660-9415-11e5-9742-c53da2f1a8ec');
select * from shahid.stock_ticks  where symbol = 'NFLX' and date = 1 and trade < unixTimestampOf('2045d660-9415-11e5-9742-c53da2f1a8ec');

删除 UUID 周围的引号。 Cassandra 对它们有原生支持,而不是通过字符串。

select * from shahid.stock_ticks  where symbol = 'NFLX' and date = 1 and trade < 2045d660-9415-11e5-9742-c53da2f1a8ec;