I'm trying to retrieve all columns of a row in Cassandra using Thrift 1.0 lib. I found some examples by Googling , in particular:
SliceQuery<String, String, String> sliceQuery = hectorTemplate.createSliceQuery(
StringSerializer.get(), StringSerializer.get(), StringSerializer.get());
sliceQuery.setColumnFamily("myname");
sliceQuery.setKey("myid");
sliceQuery.setRange(null, null, false, 20);
QueryResult<ColumnSlice<String,String>> queryResult = sliceQuery.execute();
ColumnSlice<String,String> slice = queryResult.get();
List<HColumn<String, String>> retrievedColumns = slice.getColumns();
for (HColumn<String, String> column : retrievedColumns) {
System.out.println(column.getName() +"::"+ column.getValue());
}
However, I could not find any information on what those parameters and types in Hector objects are??
For example, here:
SliceQuery<String, String, String>
Then, we specify parameters to the createSliceQuery():
hectorTemplate.createSliceQuery(
StringSerializer.get(), StringSerializer.get(), StringSerializer.get());
Again - what are those serializers for? why are there only 3 serializers - is if for the first and last column, and something else? What if I get many columns, how do I specify serializers for them?
Then, we retrieve
List<HColumn<String, String>>
-- again, what are these String types for? If I have a column of type BytesType - where do I specify that?
If there are some decent API docs (not just method signatures with no explanation of what their parameters are) - could you point me to them?
thanks! Marina
In case SliceQuery<K, C, V>
, here are the type parameters:
K -- The type of the key
C -- The type of the column name
V -- The type of the column value
Again in case of HColumn<N,V>
, type parameters are
N -- The type of the column name
V -- The type of the column value
Similar the case of createSliceQuery