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
在Cassandra中使用公共前缀获取密钥范围_Cassandra_Hector - Fatal编程技术网

在Cassandra中使用公共前缀获取密钥范围

在Cassandra中使用公共前缀获取密钥范围,cassandra,hector,Cassandra,Hector,我想使用hector API获取具有公共前缀的所有行。我玩了一点Range Superslicesky,但没有找到让它正常工作的方法。关键范围参数是否适用于通配符等 更新:我使用ByteOrderedPartitioner而不是RandomPartitioner,它可以很好地使用它。这是预期的行为吗?是的,这是预期的行为。在RandomPartitioner中,行是按其键的MD5散列顺序存储的,因此要获得有意义的键范围,需要使用像ByteOrderedPartitioner这样的保序分区器 然而

我想使用hector API获取具有公共前缀的所有行。我玩了一点Range Superslicesky,但没有找到让它正常工作的方法。关键范围参数是否适用于通配符等


更新:我使用ByteOrderedPartitioner而不是RandomPartitioner,它可以很好地使用它。这是预期的行为吗?

是的,这是预期的行为。在RandomPartitioner中,行是按其键的MD5散列顺序存储的,因此要获得有意义的键范围,需要使用像ByteOrderedPartitioner这样的保序分区器


然而,使用稍微不同的数据模型和RandomPartitioner通常可以避免一些缺点
Column slice example:

Key (without prefix) 
  <prefix1> : <data>
  <prefix2> : <data>
  ...

Secondary index example:

Key (with or without prefix)
  "prefix" : <the_prefix> <-- this column is indexed
  otherCol1 : <data>    
  ...
列切片示例:
密钥(无前缀)
: 
: 
...
二级索引示例:
键(带或不带前缀)
“前缀”: