Cassandra Hector:给定行键和辅助索引的IndexedLiceQuery

Cassandra Hector:给定行键和辅助索引的IndexedLiceQuery,cassandra,hector,Cassandra,Hector,赫克托:赫克托核心-1.0-5卡桑德拉-1.1.2 我需要在Hector中对查询进行建模,如: select * from table1 where rowkey='x' and secondary_indexed_column='y' 如果我使用一个将setStartKey设置为rowKey“x”的IndexedLiceQuery,我仍然会得到所有包含辅助列的行。 如果在AddeQualExpression(“row_key”,“x”)中添加row_key字段,则会出现以下异常: org.a

赫克托:赫克托核心-1.0-5卡桑德拉-1.1.2

我需要在Hector中对查询进行建模,如:

select * from table1 where rowkey='x' and secondary_indexed_column='y'
如果我使用一个将setStartKey设置为rowKey“x”的IndexedLiceQuery,我仍然会得到所有包含辅助列的行。 如果在AddeQualExpression(“row_key”,“x”)中添加row_key字段,则会出现以下异常:

org.apache.thrift.protocol.TProtocolException: Required field 'value' was not present! Struct: IndexExpression(column_name:64 65 76 69 63 65 5F 69 64, op:EQ, value:null)
    at org.apache.cassandra.thrift.IndexExpression.validate(IndexExpression.java:562)
    at org.apache.cassandra.thrift.IndexExpression.write(IndexExpression.java:499)
    at org.apache.cassandra.thrift.IndexClause.write(IndexClause.java:521)
    at org.apache.cassandra.thrift.Cassandra$get_indexed_slices_args.write(Cassandra.java:13469)
    at org.apache.cassandra.thrift.Cassandra$Client.send_get_indexed_slices(Cassandra.java:793)
    at org.apache.cassandra.thrift.Cassandra$Client.get_indexed_slices(Cassandra.java:781)
    at me.prettyprint.cassandra.service.KeyspaceServiceImpl$19.execute(KeyspaceServiceImpl.java:732)

那么,如何限制IndexedLiceQuery只返回给定行键的结果呢?

另一个选项是,如果您对数据进行了分区,则可以在playOrm中执行此查询,它支持分区中的数百万行(但不超过1000万行)和表中所需的任意多个分区。然后您只需执行查询

@NoSqlQuery(name=“findSomething”,query=“PARTITIONS t(:partitionId)从表中选择t作为t,其中date>:some和yyyy<:second”)


注意:注意对查询没有限制,除非它在一个分区内,您也可以进行连接

所以,我有点困惑。是否提供了要搜索特定列的行键?您不需要索引,只需读取行并检查列名和值。IndexedLiceQuery将返回一组包含指定列名/值的行(在指定的起点)。