Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nosql 使用Cassandra的查询范围日期_Nosql_Cassandra - Fatal编程技术网

Nosql 使用Cassandra的查询范围日期

Nosql 使用Cassandra的查询范围日期,nosql,cassandra,Nosql,Cassandra,我已尝试使用此架构执行查询范围日期: create column family fact_ingreso with comparator = UTF8Type and key_validation_class=UTF8Type and column_metadata = [{column_name: ing_fecing, validation_class: DateType,index_type:KEYS}]; 我用这种方式插入数据 // Date format: "2010-04-01

我已尝试使用此架构执行查询范围日期:

create column family fact_ingreso with comparator = UTF8Type and
key_validation_class=UTF8Type and 
column_metadata =
[{column_name: ing_fecing, validation_class: DateType,index_type:KEYS}];
我用这种方式插入数据

// Date format: "2010-04-01 00:00:00"
// The datos[20] has a date as a String in the above format
SimpleDateFormat formatoFecha = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date fecha = formatoFecha.parse(datos[20]);
System.out.println(fecha);
Column ing_fecing = new Column(toByteBuffer("ing_fecing"));
ing_fecing.setValue(ByteBufferUtil.bytes(fecha.getTime()));
ing_fecing.setTimestamp(timestamp);
client.insert(toByteBuffer(id_row), parent, ing_fecing, ConsistencyLevel.ONE);
到目前为止还不错,但当我尝试使用以下代码查询范围日期时:

get fact_ingreso where ing_fecing>2011-01-12;
我得到错误“在带有运算符EQ的index子句中不存在索引列”

但是,如果我将“=”的运算符“>”替换为“=”,它会工作:

get fact_ingreso where ing_fecing=2011-01-12;
输出

RowKey: 645
=> (column=ing_fecing, value=2011-01-12 00:00:00-0300, timestamp=1361899176638)
我是Cassandra数据库的新手,我真的需要为我的论文工作部署这个功能。 如果有人能帮助我,我真的很感激

编辑:卡桑德拉版本是1.2
关于

对于Cassandra,必须使用equals子句指定至少一个值;i、 你不能只指定一个范围。一种简单的方法是编写一个表示已知值的sentinel列。例如,您可以编写一个表示当前月份或年份的列,然后将其用作等式。在查询时可以知道的任何值都可以实现这一目的