Cassandra and Hector = MultiGetSliceQuery, with Column-Values of various different types?
Hallo,
I do not understand, how to query cassandra with hector, but the column-values returned are not of one single type, but of many:
I put in ???? where I do not know what to do:
MultigetSliceQuery<String, String, ??????> multigetSliceQuery = HFactory.createMultigetSliceQuery(keyspace, stringSerializer, stringSerializer, ???????);
For for example, if all my column-values ar开发者_运维技巧e of String type, I would put in String. But I have differnt ones like String, Integer, and byte[] in one single row. So I must pass in more then one Serializer.
How to solve this?
Thank you.
(can one pls create hector as tag? I am not allowed to do this)
We provide arbitrary typing via a template-method pattern. See the test case: https://github.com/rantav/hector/blob/master/core/src/test/java/me/prettyprint/cassandra/service/template/ColumnFamilyTemplateTest.java
The new getting started guide should be helpful as well: https://github.com/rantav/hector/wiki/Getting-started-%285-minutes%29
You can use the ByteBufferSerializer, and then convert the ByteBuffers returned from ByteBufferSerializer as the argument to StringSerializer and IntegerSerializer to convert the columns which are Strings and Integers.
精彩评论