use*_*166 3 cassandra murmurhash
我的Cassandra ColumnFamily使用Murmur3Partitioner,并有一个复合分区键.有了这个分区,我试图创建一个令牌,但似乎这个令牌工厂只允许Long值.是否可以为"token(partition_column1,partition_column2)"之类的东西生成这些哈希值?
它应该工作.实际上,如果您的分区键是复合键,则应该无法仅为单个列创建令牌.您确定已正确定义了复合键吗?
cqlsh:testks> create table t1(k1 int, k2 text, v text, primary key((k1, k2)));
cqlsh:testks> insert into t1(k1, k2, v) values (1, 'key', 'value');
cqlsh:testks> select * from t1;
k1 | k2 | v
----+-----+-------
1 | key | value
(1 rows)
cqlsh:testks> select token(k1) from t1;
Bad Request: Invalid number of arguments in call to function token: 2 required but 1 provided
cqlsh:testks> select token(k2) from t1;
Bad Request: Invalid number of arguments in call to function token: 2 required but 1 provided
cqlsh:testks> select token(k1, k2) from t1;
token(k1, k2)
---------------------
8064425790465501062
(1 rows)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4309 次 |
| 最近记录: |