You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Oleg Proudnikov <ol...@cloudorange.com> on 2011/09/07 19:56:26 UTC

Unable to read byte sub-column after upgrade to Cassandra 0.8

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