我是cassandra的新bie,我想在列计数器系列中获取多个行键,就像MultigetSliceQuery一样。是否有可能??? 例如我的colunfamily定义是
create column family MyCounters
with default_validation_class=CounterColumnType
and comparator=UTF8Type;
和数据结构
RowKey:111111
=>name=like, value=2222
=>name=share, value=2542
=>name=comment, value=3532
RowKey:111112
=>name=like, value=2542
=>name=share, value=25524
=>name=comment, value=32
RowKey:111113
=>name=like, value=22
=>name=share, value=22
=>name=comment, value=32
RowKey:111114
=>name=like, value=22
=>name=share, value=542
=>name=comment, value=332
RowKey:111115
=>name=like, value=949
=>name=share, value=226
=>name=comment, value=342
现在我想使用multi getslice query获取所有行键。是否可以使用多重切片查询或任何其他查询来获取记录?
答案 0 :(得分:1)
最后我得到了解决方案
MultigetSliceCounterQuery<String, String> query=HFactory.createMultigetSliceCounterQuery(keyspace, se, se);
query.setColumnFamily("MyCounters").setKeys(list).setRange(null, null, false, 3);
CounterRows<String,String> resultRows1 = query.execute().get();
for (CounterRow<String, String> row : resultRows1) {
System.out.println("Row Key "+ row.getKey());
for (HCounterColumn<String> col : row.getColumnSlice().getColumns())
System.out.println("column Name "+col.getName()+"column value "+col.getValue());
}
}
答案 1 :(得分:-2)
使用昆德拉。运行简单的JPQL以获得多个结果。