使用 hector api 从复合列中读取时遇到问题。
我的专栏家庭:
create column family step_wise_stats_cc with key_validation_class = 'CompositeType(UTF8Type, UTF8Type)' and comparator = UTF8Type and default_validation_class = UTF8Type;
数据:行键:{TYPE-1,SUB-TYPE-1}
列:名称1:值1
我这样查询它:
Cluster cluster = HFactory.getOrCreateCluster("cls1", "localhost:9160");;
Keyspace keyspace = HFactory.createKeyspace("ks1",cluster);;
Serializer se = StringSerializer.get();
Composite start = new Composite();
start.addComponent(0, "TYPE-1", ComponentEquality.EQUAL);
start.addComponent(1, "SUB-TYPE-1", ComponentEquality.EQUAL);
Composite end = new Composite();
end.addComponent(0, "TYPE-1", ComponentEquality.GREATER_THAN_EQUAL);
start.addComponent(1, "SUB-TYPE-1", ComponentEquality.GREATER_THAN_EQUAL);
SliceQuery<String, Composite, String> sliceQuery = HFactory.createSliceQuery(keyspace, se, CompositeSerializer.get(), se);;
sliceQuery.setColumnFamily("cf1");
sliceQuery.setKey("TYPE-1");
sliceQuery.setRange(start, start, false, 999);
QueryResult<ColumnSlice<Composite, String>> qr = sliceQuery.execute();
但得到以下异常:me.prettyprint.hector.api.exceptions.HInvalidRequestException: InvalidRequestExc eption(为什么:没有足够的字节来读取组件 0 的值)
有什么帮助吗?