Reading rows in cassandra and de-serialzation issue

99 views
Skip to first unread message

strauberry

unread,
Jun 18, 2011, 9:14:44 AM6/18/11
to hector-users
Hi everybody,

I'd like to get all rows from a column family and display all columns
as well. I tried this one:

CqlQuery<String, String, String> cqlQuery =
new CqlQuery<String, String, String>(fKeyspace, fStringS,
fStringS, fStringS);
cqlQuery.setQuery("SELECT * FROM ColumnFamily");

QueryResult<CqlRows<String, String, String>> result =
cqlQuery.execute();

CqlRows<String, String, String> rows = result.get();
for (Row<String, String, String> row : rows.getList()) {
System.out.println(row.getKey() + ":");
for(HColumn<String, Object>col :
row.getColumnSlice().getColumns()) {
System.out.println(col.getName() + " : " + col.getValue());
}
}
}

The problem is, that all the columns which have long-values for
example are empty. If I change the last "parameterizer" to Object, I
get a "CorruptedStreamException". How do I have to do this?

Thank you very much!

Best
Christian

Nate McCall

unread,
Jun 20, 2011, 1:32:43 AM6/20/11
to hector...@googlegroups.com
You are typing your column value as String (third type param in:
Row<String,String,String>) yet you type the HColumn as an object.

To treat them generically, type them as ByteBuffers.

Reply all
Reply to author
Forward
0 new messages