根据this文档,我尝试使用包含token()函数的select查询,但结果不正确。
我正在使用以下Cassandra版本。
插入的数据--
选择查询是--
这个查询应该返回创建时间为2000年的一行记录,但是它返回了零行记录。
根据我的理解,token(objectid,createdOn) > token(1,1000) 和 token(objectid,createdOn) < token(1,3000) 应该选择分区键值为1和2000的行。
我的理解正确吗?
我正在使用以下Cassandra版本。
[cqlsh 5.0.1 | Cassandra 2.2.5 | CQL spec 3.3.1 | Native protocol v4]
我正在尝试对下面的表进行令牌查询 -
CREATE TABLE price_key_test (
objectid int,
createdOn bigint,
price int,
foo text,
PRIMARY KEY ((objectid, createdOn), price));
插入的数据--
insert into nasa.price_key_test (objectid,createdOn,price,foo) values (1,1000,100,'x');
insert into nasa.price_key_test (objectid,createdOn,price,foo) values (1,2000,200,'x');
insert into nasa.price_key_test (objectid,createdOn,price,foo) values (1,3000,300,'x');
表格中的数据 --
objectid | createdon | price | foo
----------+-----------+-------+-----
1 | 3000 | 300 | x
1 | 2000 | 200 | x
1 | 1000 | 100 | x
选择查询是--
select * from nasa.price_key_test where token(objectid,createdOn) > token(1,1000) and token(objectid,createdOn) < token(1,3000)
这个查询应该返回创建时间为2000年的一行记录,但是它返回了零行记录。
objectid | createdon | price | foo
----------+-----------+-------+-----
(0 rows)
根据我的理解,token(objectid,createdOn) > token(1,1000) 和 token(objectid,createdOn) < token(1,3000) 应该选择分区键值为1和2000的行。
我的理解正确吗?