incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Proudnikov <ol...@cloudorange.com>
Subject Unable to read byte sub-column after upgrade to Cassandra 0.8
Date Wed, 07 Sep 2011 17:56:26 GMT
Hi,

Just wanted to share an issue I had to overcome after upgrading to Cassandra 0.8
from 0.7. My app became unable to read a BytesType sub-column.

It turned out that ByteBuffer returned as a value of a sub-column can not be
assumed to contain only the bytes of the sub-column. As a result one has to use
relative access methods on the ByteBuffer. 

In other words the array below contains column value not at position 0 but at
position value.position(). 

for (HColumn<String,ByteBuffer> column : superColumn.getColumns()) {
	ByteBuffer value = column.getValue();
	byte[] array = value.array();
}

Oleg





Mime
View raw message