相关疑难解决方法(0)

Cassandra:使用where子句查询包含更大或更小的(<和>)

我正在使用Cassandra 1.1.2我正在尝试将RDBMS应用程序转换为Cassandra.在我的RDBMS应用程序中,我有以下表名为table1:

| Col1 | Col2 | Col3 | Col4 |
Run Code Online (Sandbox Code Playgroud)
  1. Col1:String(主键)
  2. Col2:String(主键)
  3. Col3:Bigint(索引)
  4. Col4:Bigint

该表计有超过2亿条记录.最常用的查询类似于:

Select * from table where col3 < 100 and col3 > 50;
Run Code Online (Sandbox Code Playgroud)

在Cassandra中,我使用以下语句来创建表:

create table table1 (primary_key varchar, col1 varchar, 
col2 varchar, col3 bigint, col4 bigint, primary key (primary_key));

create index on table1(col3);
Run Code Online (Sandbox Code Playgroud)

我将主键更改为一个额外的列(我计算了我的应用程序中的键).导入几条记录后,我尝试执行以下cql:

select * from table1 where col3 < 100 and col3 > 50;
Run Code Online (Sandbox Code Playgroud)

结果是:

Bad Request: No indexed columns present in by-columns clause with Equal operator
Run Code Online (Sandbox Code Playgroud)

查询从table1中选择col1,col2,col3,col4,其中col3 = 67有效 …

cql where-clause cassandra

7
推荐指数
1
解决办法
4634
查看次数

标签 统计

cassandra ×1

cql ×1

where-clause ×1